Slide 1

Slide 1 text

Ship your app on a Friday and enjoy your weekend @POLPIELLADEV @[email protected] ! Do iOS 2024 /IN/POLPIELLADEV

Slide 2

Slide 2 text

Indie developer and content creator based in Barcelona Pol Hi! I’m Pol

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

polpiella.dev

Slide 5

Slide 5 text

ioscinewsletter.com

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

Mobile releases are difficult there is no denying that!

Slide 8

Slide 8 text

Accurate representation of an iOS Engineer being asked if they want to manage a release

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

Mobile releases can be risky. Let’s just not ship them on a Friday.

Slide 18

Slide 18 text

Gain confidence in your releases and ship anytime! A few tips to…

Slide 19

Slide 19 text

#1 Automate as much as possible

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

Fully automated

Slide 22

Slide 22 text

desc "Distributes a new build to App Store Connect" lane :distribute do version_number = git_branch.split("/", -1).last setup_ci xcode_select("/Applications/Xcode_16.app") sync_code_signing( type: "appstore", app_identifier: ["com.appdiggershq.fosi"], readonly: true ) increment_version_number(version_number: version_number, xcodeproj: "Fosi.xcodeproj") app_store_connect_api_key( key_id: ENV["APP_STORE_CONNECT_API_KEY_ID"], issuer_id: ENV["APP_STORE_CONNECT_ISSUER_ID"], key_content: ENV["APP_STORE_CONNECT_KEY_CONTENT"] ) build_number = latest_testflight_build_number + 1 increment_build_number(xcodeproj: "Fosi.xcodeproj", build_number: build_number) build_app(scheme: "Fosi", configuration: 'Release', output_name: "Fosi.ipa") upload_to_app_store(ipa: "Fosi.ipa", precheck_include_in_app_purchases: false) if !git_status(path: "Fosi.xcodeproj/project.pbxproj").empty? git_commit(path: "Fosi.xcodeproj/project.pbxproj", message: "[ci skip] [" release] Updating version") push_to_git_remote(remote: "origin", remote_branch: git_branch) end end

Slide 23

Slide 23 text

name: Distribute to the App Store Connect concurrency: group: $!" github.workflow !#-$!" github.ref !# cancel-in-progress: true permissions: contents: write on: push: branches: - 'release!!$' jobs: distribute: runs-on: [macos-14] steps: - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: bundler-cache: true - run: bundle exec fastlane distribute env: APP_STORE_CONNECT_API_KEY_ID: $!" secrets.APP_STORE_CONNECT_API_KEY_ID !# APP_STORE_CONNECT_ISSUER_ID: $!" secrets.APP_STORE_CONNECT_ISSUER_ID !# APP_STORE_CONNECT_KEY_CONTENT: $!" secrets.APP_STORE_CONNECT_KEY_CONTENT !# MATCH_GIT_BASIC_AUTHORIZATION: $!" secrets.MATCH_GIT_BASIC_AUTHORIZATION !# MATCH_USERNAME: $!" secrets.MATCH_USERNAME !# MATCH_PASSWORD: $!" secrets.MATCH_PASSWORD !#

Slide 24

Slide 24 text

A comprehensive test suite will drastically improve confidence

Slide 25

Slide 25 text

A comprehensive test suite will drastically improve confidence* If you actually remember to run them!

Slide 26

Slide 26 text

Where should you run tests? PRs to the development branch Before uploading to ASC On Nightly or Scheduled Workflows

Slide 27

Slide 27 text

If there is a manual task that causes friction, automate it!

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

#2 Test your release pipeline

Slide 30

Slide 30 text

# App Target $ ModuleA.framework $ ModuleB.framework

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

$ ModuleA.framework $ ModuleB.framework # App Target

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

lane :nightly do # Let's make some magic happen % gym( project: "./AwesomeApp.xcodeproj", clean: true, derived_data_path: "./derived-data", output_directory: "./build", output_name: "AwesomeApp.ipa", scheme: "AwesomeApp", export_options: { provisioningProfiles: { "your.bundle.identifier" !% "Your Provisioning Profile Name", } } ) deliver( ipa: "build/AwesomeApp.ipa", verify_only: true ) end

Slide 36

Slide 36 text

name: Nightly on: schedule: - cron: '0 0 * * *' jobs: nightly: runs-on: macos-latest steps: - uses: actions/checkout@v2 - name: Run nightly lane run: bundle exec fastlane nightly

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

#3 Adopt a release strategy

Slide 40

Slide 40 text

No content

Slide 41

Slide 41 text

No content

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

Quality matters WAY MORE than quantity The silver bullet of release frequency

Slide 45

Slide 45 text

Release less, more o!en*! Use release trains to… *Always allowing ample time for beta testing and QA

Slide 46

Slide 46 text

You’ll unleash these benefits & Reduced risk ' Predictability ( Faster Feedback

Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

#4 Use Feature Toggles

Slide 49

Slide 49 text

You can just turn it off! If something goes wrong in production…

Slide 50

Slide 50 text

enum ToggleableFeature: String { case homeSwiftUIRefactor = "homeRefactor" } struct HomeViewWrapper: View { @Environment(FeatureToggleService.self) var featureToggles var body: some View { if featureToggles.isOn(.homeSwiftUIRefactor) { HomeView() } else { LegacyHomeView() } } }

Slide 51

Slide 51 text

No content

Slide 52

Slide 52 text

#5 Observe and Monitor

Slide 53

Slide 53 text

You first need to know that one is happening! To quickly react to an incident

Slide 54

Slide 54 text

Crashes & Performance

Slide 55

Slide 55 text

Crashes & Performance

Slide 56

Slide 56 text

Crashes & Performance

Slide 57

Slide 57 text

No content

Slide 58

Slide 58 text

Analytics

Slide 59

Slide 59 text

Customer Satisfaction

Slide 60

Slide 60 text

Customer Satisfaction

Slide 61

Slide 61 text

User Feedback

Slide 62

Slide 62 text

User Feedback

Slide 63

Slide 63 text

User Feedback

Slide 64

Slide 64 text

No content

Slide 65

Slide 65 text

CI/CD Velocity Metrics

Slide 66

Slide 66 text

No content

Slide 67

Slide 67 text

#6 Do not release to all users at once

Slide 68

Slide 68 text

No content

Slide 69

Slide 69 text

No content

Slide 70

Slide 70 text

No content

Slide 71

Slide 71 text

No content

Slide 72

Slide 72 text

No content

Slide 73

Slide 73 text

import AWSLambdaRuntime import AWSLambdaEvents import AppStoreConnect_Swift_SDK @main struct PausePhasedReleaseWebhook: SimpleLambdaHandler { func handle(_ event: APIGatewayV2Request, context: LambdaContext) async throws !& APIGatewayV2Response { guard let body = event.body else { return .init(statusCode: .badRequest) } !' Read the webhook payload and decide whehter to stop the release or not!!( } }

Slide 74

Slide 74 text

func handle(_ event: APIGatewayV2Request, context: LambdaContext) async throws !& APIGatewayV2Response { }

Slide 75

Slide 75 text

func handle(_ event: APIGatewayV2Request, context: LambdaContext) async throws !& APIGatewayV2Response { !' … !' Get latest live version let endpoint = APIEndpoint .v1 .apps .id("1234567890") .appStoreVersions .get(parameters: .init(filterPlatform: [.ios], filterAppVersionState: [.readyForDistribution])) let response = try await provider.request(endpoint) let allPhasedReleases = response.included? .compactMap { item in if case .appStoreVersionPhasedRelease(let phasedRelease) = item { return phasedRelease } return nil } guard let id = allPhasedReleases!)first!)id else { return .init(statusCode: .notFound) } }

Slide 76

Slide 76 text

func handle(_ event: APIGatewayV2Request, context: LambdaContext) async throws !& APIGatewayV2Response { !' … let attributes = AppStoreVersionPhasedReleaseUpdateRequest.Data.Attributes( phasedReleaseState: .paused ) let data = AppStoreVersionPhasedReleaseUpdateRequest.Data( type: .appStoreVersionPhasedReleases, id: id, attributes: attributes ) let requestBody = AppStoreVersionPhasedReleaseUpdateRequest(data: data) let phasedReleaseEndpoint = APIEndpoint .v1 .appStoreVersionPhasedReleases .id(id) .patch(requestBody) _ = try await provider.request(phasedReleaseEndpoint) return .init(statusCode: .ok) }

Slide 77

Slide 77 text

*Things that are out of your control and fail oMen *Your core business logic that your app depends on #7 Move risky* logic to the server!

Slide 78

Slide 78 text

No content

Slide 79

Slide 79 text

No content

Slide 80

Slide 80 text

No content

Slide 81

Slide 81 text

Ship bug fixes worldwide for all versions of your app Within seconds…

Slide 82

Slide 82 text

# Your App • Risky logic • Risky models

Slide 83

Slide 83 text

$ Risky Models # Your App • Risky logic

Slide 84

Slide 84 text

$ Risky Models # Your App ⚙ Risky Logic (BE)

Slide 85

Slide 85 text

No content

Slide 86

Slide 86 text

#8 Roll back to a stable version immediately

Slide 87

Slide 87 text

1.0.0

Slide 88

Slide 88 text

1.0.0 1.0.1

Slide 89

Slide 89 text

1.0.0

Slide 90

Slide 90 text

1.0.0 1.0.1

Slide 91

Slide 91 text

1.0.0 1.0.1 1.0.2

Slide 92

Slide 92 text

1.0.0 1.0.2

Slide 93

Slide 93 text

No content

Slide 94

Slide 94 text

Gain confidence on your release process! Automate manual processes Use Feature Toggles Leverage the BE ecosystem Observe and Monitor Ship less, more o!en! Roll back to stable versions of your app How to use CI/CD to ship your mobile apps

Slide 95

Slide 95 text

And ship your apps on a Friday… or anytime! Gain confidence in your releases

Slide 96

Slide 96 text

Find me online! Last tickets!