A Busy Developer’s Guide to native iOS apps
Android vs. iOS. It’s a frequent discussion between developers on which is better, faster, easier to develop with. In general, developers pick one platform to focus on—however, it’s imperative for strong developers to have an understanding of both platforms and be able to see a problem from both perspectives. The platforms are unique but also evolve together, matching features. As a Senior Software Engineer at The New York Times, I develop both native Android and iOS core libraries for our apps. In this presentation, we will discuss some of the similarities and differences between Android & iOS and give developers a better understanding of native iOS from an Android perspective.
In this presentation, you will learn about:
Design Element differences
Swift vs. Kotlin
iOS app setup & structure (Xcode vs. Gradle)
iOS app lifecycles
MVVM
Jetpack Compose vs. Swift UI
By the end of this talk, you will be able to better understand Swift code, bring both platform perspectives to product and architecture conversations, and have more confidence contributing to iOS apps and libraries.
https://chicagoroboto.com/session/understanding-native-ios-from-an-android-perspective/
34. • All protocols, classes, and structs
are extendable.
• Expect extensions on classes to
help modularize the code (within
the same class or in other
classes)
• Search by class name to find
where it has been extended
Swift
Extensions
35. Topics
1. Design Differences
2. Swift vs. Kotlin
3. App Setup & Structure
4. App Lifecycles & Architecture Patterns
5. Swift UI vs. Jetpack Compose
...
38. Workspace
What documents / projects do I contain?
At a high level
Project Project
Represents
app/library/framework.
What are the source
documents, file structure, and
basic project wide settings?
Project
Target
Target
Target
How to build / run each
app / library?
Target
Target
55. Popular iOS Third Party Libraries
• Alamofire / AFNetworking (HTTP calls)
• Lottie (Image Rendering)
• RxSwift (RxJava for Swift) or just use Combine
• YapDatabase (Sqlite Database – similar to Room)
• Resolver (Dependency Injection – similar to Hilt)
56. Topics
1. Design Differences
2. Swift vs. Kotlin
3. App Setup & Structure
4. App Lifecycles & Architecture Patterns
5. Swift UI vs. Jetpack Compose
......
57. Main iOS App Lifecycles
Not Running
App is in foreground
Inactive
Active
App is in background
Background
Suspended
58. Handling iOS App Lifecycles
callbacks for lifecycle
callbacks windows / UI lifecycles
SwiftUI Apps
This is an example of a SwiftUI app entry point w/ @main
App can be configured to use AppDelegate
Scene replaces SceneDelegate
UIViewController / Non-Swift UI
59. Main iOS App Lifecycles
Not Running
Finished launching,
next step to come into
foreground
60. Main iOS App Lifecycles
Not Running
App is in foreground
Inactive
61. Main iOS App Lifecycles
App is in foreground
Inactive
Active
62. Main iOS App Lifecycles
App is in foreground
Inactive
Active
65. MVVM on iOS
• No viewModel is built in with iOS
• POJO w/ properties and/or
functions for view to react on or
update
• Up to devs to determine how
much business logic in
viewModel
66. Topics
1. Design Differences
2. Swift vs. Kotlin
3. App Setup & Structure
4. App Lifecycles & Architecture Patterns
5. Swift UI vs. Jetpack Compose
!
83. iOS
• Lists are Tables
• SwiftUI à List {…}
• Lists are RecyclerViews +
Adapters / ListViews
• JetpackCompose à Lists are
LazyColumns
Lists
Android
84. ARC vs Garbage Collection
• ARC = automatic reference counting
• Improved performance (any numbers?)
• How it works? Counts number of references on a class then if number
is 0, removes that bit of data, unlike Garbage collection that waits till a
moment in time then cleans up things that don’t have references
• Requirements for weak self in closure (similar to do not pass context
references) ß needs code example
85. Loading up an Application
• .xcodeproj file (list of files / objects for
xcode to load) – grouped by type
• Xcode builds application w/ configuration on
`target` with rules to build bundle from
Info.plist + source files
• Compile task: takes source code (.h, .m,
.swift) and makes into object files (.o)
• Link task: links object files to make
executable library output file (.app)
93. On Background
• Save User State / Data
• Suspend dispatch / operation queues
• Don’t start any new tasks
• App will take snapshot image of current state
to show when app is starting back up
(*Android also does this)
App Manager