Skip to content
This repository has been archived by the owner on Jan 26, 2021. It is now read-only.

Tech Stack

Yugantar Jain edited this page Aug 29, 2020 · 13 revisions

The Mentorship iOS app has been built natively in Swift using SwiftUI.

Summary:

Swift

Swift is the standard programming language for development on Apple platforms.

"Swift is a powerful and intuitive programming language for macOS, iOS, watchOS, tvOS and beyond. Writing Swift code is interactive and fun, the syntax is concise yet expressive, and Swift includes modern features developers love. Swift code is safe by design, yet also produces software that runs lightning-fast." - Apple Developer.

SwiftUI

SwiftUI is a new framework for UI development launched by Apple at WWDC19. SwiftUI uses a declarative syntax in conjunction with the subscriber-publisher pattern (Combine framework) to build better apps in less time. We have embraced the latest framework and the future of development on Apple platforms in the Mentorship iOS app.

"SwiftUI is an innovative, exceptionally simple way to build user interfaces across all Apple platforms with the power of Swift. Build user interfaces for any Apple device using just one set of tools and APIs. With a declarative Swift syntax that’s easy to read and natural to write, SwiftUI works seamlessly with new Xcode design tools to keep your code and design perfectly in sync. Automatic support for Dynamic Type, Dark Mode, localization, and accessibility means your first line of SwiftUI code is already the most powerful UI code you’ve ever written." - Apple Developer

Model View ViewModel (MVVM) Architecture

The MVVM architecture consists of three parts - Model, View, and ViewModel.

The ‘Model’ encapsulates the data required by the app. The Mentorship iOS app has several different data models suited for their purpose, example: LoginModel, MembersModel, ProfileModel, etc.

The ‘ViewModel’ is derived from the main model and is a model tailored for the View. The ViewModel is responsible for providing all the necessary data required by the View to present the user interface through data bindings.

The ‘View’ is responsible for presenting the user interface using the data from the ViewModel.

MVVM ensures the separation of view from the model and add a view model in between which communicates with both - the View and the Model. This separation allows for enhanced development and also testability of different components of the app. The MVVM architecture is used in the mentorship iOS app since it fits nicely with the SwiftUI framework. SwiftUI's support and rather extensive use of data bindings, along with the usage of subscriber-publisher pattern using the Combine framework made MVVM a good choice.

Repository Pattern

The Mentorship iOS app features ‘Repository’ pattern, where data coming from different sources are mapped to a single data model. For example: the app may get its data from multiple sources including local DB and server-side APIs. The Repository pattern is used to convert(map) both of these data models (db, api) to our data model. This enhances modularity in the app and provides greater separation of the other elements from the model. For instance, it won’t matter whether the Model gets its data from db or api, the ViewModel and the View will remain unaffected since they are mapped to a single data model.