Skip to content

JohnWYWallace/Swift-Design-Patterns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 

Repository files navigation

Swift-Design-Patterns

In order to build more complex apps, understanding design patterns is crucial. A design pattern will help us get organized and structure your code, it is a proven solution to a common problem. The common problem in software is complexity. A good analogy would be comparing managing a wind turbine to a nuclear plant. A wind turbine would be relatively easy to manage. On the flip side a nuclear plant needs the right attention otherwise you could be left with a messy situation. There are many different design patterns that I am aware of. A simple list would be MVC, Facade, Object Pool, Singleton, Iterator, MVP, Decorator, Mediator, Template, Adapter, Observer, Strategy, Composite, Command, Delegate, VIPER, Factory. A design pattern is like an architectural blueprint. It is requirement based. Depending on what app your building you will need to use different design pattern. Design patterns are also style based.

Model View Controller (MVC) is the design pattern is used by Apple. You split your project into three main components. The model the view and the controller. The model component handles all the data and logic. The view component handles the user interface and deals with user interaction. The controller component is the mediator of the two. When some one taps on a button in your app. The view sends a message to the controller about the event and the controller interprets that and makes a request to our model for some data. Then the model sends data back to the controller, it will then interpret it and modify the view interface. The view and the model never directly talk to each other, it is always through the controller.

About

This is notes I have taken on Swift design patterns.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published