Files
notes/docs/lectures/mdp/17_cross_app_dev.md
T

85 lines
2.8 KiB
Markdown

# iOS and Cross-Platform Development
![image-20220118173020092](img/cd.png)
| | Android | iOS |
| -------------------- | :-------------------------: | :---------------------------: |
| Market Share | 82% | 13.9% |
| Programming Lang | Java<br />Kotlin | Objective-C<br />Swift (2014) |
| IDE | Eclipse<br />Android Studio | Xcode |
| OS | Windows/Mac/Linux | Only on Mac! |
| Distribution Process | Release can take hours | Release can take weeks |
| Fees | \$24 one-off | \$99 per year |
### iOS
- Based heavily on Mac OS X
- Closed source
- Tools, deployment, app ecosystem controlled by Apple
- Apps can only be installed from the App Store
- Cryptographically signed
- Apple runs App Store
- Approves all apps available from it
#### iOS Apps
- Written in Objective-C & Swift
- An extension of C to add support for objects
- Using the Cocoa Touch UI framework
- Can also use C/C++ libraries
- Compiles to native code via LLVM (not interpreted (JIT) as on Android)
##### Structure of an App
**M**odel **V**iew **C**ontroller Design Pattern
![image-20220118174042986](img/ce.png)
**UI Application Object**: manages event loop & high-level app behaviour
**Application Delegate**: Handles app initialisation and state transitions
**Data Objects**: Store data for the app (images, database, etc.)
**Document**: Manage data objects
**View Controller**: Manages the presentation of the app on the screen, loads views, shows views, rotates views, etc.
**UI Window**: Coordinates the presentation of one or more views on a screen
**Views & UI objects**: Draw content, buttons, etc.
##### iOS Lifecycle
- Apps are sandboxed; inter-app communication is used to pass data
- Only one application in the foreground / visible at once
- A main loop processes events for the application
- Xcode creates the main function
- App can be in a number of significant states
- Active: foreground
- Inactive: foreground but interrupted
- Background: same as services in Android
- Suspended: main loop no longer running; remains in memory but is potentially killed by the operating system
##### State Transitions
![image-20220118175629095](img/cf.png)
![image-20220118175733832](img/cg.png)
![image-20220118180929130](img/da.png)
#### App Store
- Pre-moderation
- Apple checks all applications in advance manually
- Versus Android: publish and then revoke
- A long list of guidelines as to what is appropriate
## Cross-platform
#### Xamarin
- Developed by Microsoft
- `xamarin.Forms` for native UI code