# Notes on mobile apps
<!-- Put the link to this slide here so people can follow -->
###### slides: https://hackmd.io/@n8t4rsGgRvy_5ydqDXMGfw/r1G7AZMfU
---
### MVVM Pattern
- iOS specific :iphone:
----
#### Why
- Faster to implement
- Easier to read and maintain
- Separated responsibilities
----
#### How :bulb:
- Organize the project
- Good practices doc
- Educate the team
---
### Navigation Router (or Coordinator)
----
#### Why
- Business requirements to:
- Change navigation order
- Change pages hierarchy
- Error prone and time consuming
- Tight Coupling (only Page A knows how to nav to Page B)
----
#### How :bulb:
- Existent router pattern
- Easy to implement on new project (3.0!)
- Good practices doc
- Educate the team
---
### SwiftUI
----
#### Why
- *Code the UI* and layout constraints
- Lot of time to implement
- Difficult to learn
- Leads to UI glitches and bugs
- Storyboards not ideal
- No source code control
- Produces coupled navigation
- No hot-reload
----
#### How :bulb:
- iOS 13+ and Swift 5+
- Source Code control
- Hot-reload
- No need to concern about MVVM
---
### Codable Protocol
----
#### Why
- RestKit
- Other third-party libraries
----
#### How :bulb:
- Native swift solution
- Official docs
- Educate the team
---
## Security
----
### App Transport Security (ATS)
----
#### Why
- Apple native solution
- Communicate only to whitelisted domains
- Prevents potential security flaws
----
#### How :bulb:
- Simple configuration
- Map current and future URLs
- Attachments, hyperlinks and scorms
:::danger
Current status: **OFF** (Allowing arbitrary loads)
:::
---
## Source code maintenance
----
### Using git
- CI/CD flow
- Already familiar
- One more branch: deploy
----
```flow
req=>start: Feature Requested
e=>end: Master
feat=>operation: MyFeatureBranch
dev=>operation: Develop
dep=>operation: Deploy
cond=>condition: Success?
req->feat->dev->dep->cond
cond(yes)->e
cond(no)->feat
```
----
#### Skip the details
- Feature branches should **always** be generated from master;
- Develop branch can receive multiple merges;
- A simple merge to Deploy branch starts the **Automated flow**
- If the build succeeds, a binary app will be uploaded to App Store;
- Finally, Deploy branch code is merged to Master
---
## Testing
----
### Unit Testing
- Coverage should get to 100%
- Can be done gradualy
- Verified when pushing code to github
----
### Integration testing
- Test same binary to be sent to App Store
- App needs to be able to switch between environments:
- Separate "host switcher" app
- Have special user accounts
---
## Continuous integration and delivery
----
#### Why
- Security
- Increases development speed
- Increases release build gen speed
- Defined Process
----
#### How :bulb:
- Maintain build server in house
or
- Paid services like:
- ~~Circle CI~~, ~~BuddyBuild~~, Bitrise or Travis CI
---
## Releasing Features
----
### Feature Flags
----
#### Why
- Rapidly answer clients requests
- App Store review times
- Send our features to production **ahead of time**
----
#### How
- Already have
- Enable through admin panel
- Decrease gaps between deploys
---
### Wrap up
- MVVM, Router, Codable Protocol
- SwiftUI, Apple ATS
- CI/CD, Testing
---
### Thank you!
luiz@actoapp.com
{"metaMigratedAt":"2023-06-15T03:53:45.804Z","metaMigratedFrom":"YAML","title":"Notes on mobile apps","breaks":true,"description":"View the slide with \"Slide Mode\".","contributors":"[{\"id\":\"9fcb78ae-c1a0-46fc-bfe7-276a0d73067f\",\"add\":9609,\"del\":6136,\"latestUpdatedAt\":null}]"}