VIPER/CleanSwift. Where to put reusable business-logic that is used across many views? [closed] - swift

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I want to start using CleanSwift architecture, especially the VIPER interpretation thereof, but I have some question.
Example: I have cart view. When some new item added to cart, that view update data (count increase). And when I press on it - open "CartViewController". I use that view many times across app, and code-base in only one.
Question: How can that view be implemented via VIPER as an interpretation of a CleanSwift architecture? I need to implement that the business logic somewhere that corresponds to every view for each scene in the view/UI zone of VIPER? How do I separate the business-logic concern in VIPER from the view UI concern so that VIPER inhibits massive-view-controller anti-pattern or malarchitecture? But also how can I do that while achieving a re-use of that business logic when it is the same?

Related

Is Using MVVM with SwiftUI a 'bad practice'? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 days ago.
Improve this question
I am writing a SwiftUI app and am having a hard time understanding the best architectural pattern to go with. I know MVVM is the go-to in mobile development in general, but have also seen sources that say that swiftUI has MVVM built in, so all that is needed is MV. Here is one such source: https://developer.apple.com/forums/thread/699003. This and many other articles say that using swiftUI with MVVM is redundant.
I've also seen other sources that say MVVM is just fine for swiftUI.
Is it just a matter of personal preference? Or, is explicitly defining viewmodels redundant in swiftUI?
Should you factor out the logic that adapts your data model for use by your views? Sometimes.
Do you need a four-letter initialism, a rigid process, or a slew of wannabe-influencers and pundits telling you how to do it? Rarely.
Keep in mind that MVVM was designed specifically for Windows Presentation Framework. If you're looking for an app architecture designed for SwiftUI, try the Composable Architecture.

Firestore Listeners Best Practices While Updating My UI [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
Do I need to put my Firestore listeners in my View Controller or can I put them in a model class? Based on my research, best practices is apparently to keep the database code within separate models.
However, I need to update my UI based on database changes.
That means I should at least attach the listeners within my View Controllers and not in the model, correct?
Or am I violating best practices here?
Blessings.
Tai
Yes, you need to put your listener on your viewController or you can create another class like singleton contains listener methods and with it's methods update the Ui.This also reduce the rewriting of the same code.

Teleprompter app in Xcode using Swift [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have finished an online course in iOS development on Udemy and I'm ready to start developing my first (real) app.
My goal is to make a teleprompter app similar to: https://itunes.apple.com/dk/app/video-teleprompter-lite/id1031079244?mt=8
To start with, I would like to create just the moving text. I have looked at various concepts such as Core Animation, Text View, Segue from one view controller to another etc. But none of them seem to be able to display the moving text in the proper "teleprompter way".
I would really appreciate suggestions as to how to start/which relevant concepts to look at in this context.
Try reading up on UIDynamics, UIPushBehavior.
https://developer.apple.com/reference/uikit/uidynamicanimator

Entity Framework with Waterfall or Agile? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I've seen plenty of posts on the pros and cons of the EF but finding quite hard to find anything on the relationship between EF and project management methodologies such as Waterfall SDLC and Agile?
Would anyone have any links or information on the above? Thanks.
Frameworks and methodologies are typically orthogonal.
The only (indirect) relationship is that Agile methods would have you build your application to be decoupled from the persistence mechanism altogether. In fact, you would delay even using a database until you have a user story that requires that you have one. This would force you to keep the two decoupled, leaving your options open.

Is there a way to create a series of UIAlertViews that are daisy chained into a decision tree? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Is there a way or a model by which I could create a "Choose your own adventure" type app using UIAlertViews?
While this is not a direct answer to the question, what you're going for here is going to provide a less than ideal user experience. Alerts are jarring and not really meant to be a constant UI element but more of an occasional interruption.
That said, if you do want to do something like this, using a block handler pattern rather than a delegate pattern will make the logic of your app much simpler and easier to follow.
For Xcode5/iOS7, I would recommend taking a look at BlocksKit which includes a category on UIAlertView to use completion blocks instead of a delegate.
New in iOS8 is the UIAlertController class which handles this very similarly without a need for an external component. It does require iOS 8 to use though.