Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Merpay iOSにおけるSwift Concurrency対応の挫折と今後 / Swift Concurrency Support for Merpay for iOS: Frustration and Where to Go From Here

mercari
October 14, 2023

Merpay iOSにおけるSwift Concurrency対応の挫折と今後 / Swift Concurrency Support for Merpay for iOS: Frustration and Where to Go From Here

メルペイiOSチームでは去年から今年の始めまで、Swift Concurrency対応を行っていました。Swift 6に対応するため、ビルドオプションを変更し、コンパイルにConcurrencyチェックを適応するプロジェクトです。それによって様々なSwift Concurrencyのナレッジを手にすることはできましたが、結果的に対応したバージョンをリリースすることはできませんでした。
このセッションでは、どんなConcurrency対応をしたか、プロジェクト中止の判断、今後の見通しなどを説明します。

From last year to the beginning of 2023, the Merpay iOS team worked on Swift concurrency handling. The project involved changing build options and applying concurrency checks with a compiler in order to support Swift 6. In doing this, we gained a variety of knowledge about Swift concurrency, but in the end we were unable to release a version that supported concurrency.
In this session, we explain the nature of the concurrency handling that we did, the reasons why we decided to stop the project, and our projections going forward.

------
Merpay & Mercoin Tech Fest 2023は3日間のオンライン技術カンファレンスです。
IT企業で働くソフトウェアエンジニアおよびメルペイ・メルコインの技術スタックに興味がある方々を対象に2023年8月22日(火)、23日(水)、24日(木)の3日間、開催します。 Merpay & Mercoin Tech Fest は事業との関わりから技術への興味を深め、プロダクトやサービスを支えるエンジニアリングを知ることができるお祭りです。

今年のテーマは「Unleash Fintech」。 メルペイ・メルコインのこれまでの技術的な取り組みはもちろん、メルカリグループのFintech事業における新たな挑戦をお伝えします。 セッションでは事業を支える組織・技術・課題などへの試行錯誤やアプローチなど多面的にご紹介予定です。

メルペイ・メルコインが今後どのようにUnleash(解放)していくのか、ぜひ見に来てください。

■イベント関連情報
- 公式ウェブサイト:https://events.merpay.com/techfest-2023/
- 申し込みページ:https://mercari.connpass.com/event/286670/
- Twitterハッシュタグ: #MerpayMercoinTechFest
■リンク集
- メルカリ・メルペイイベント一覧:https://mercari.connpass.com/
- メルカリキャリアサイト:https://careers.mercari.com/
- メルカリエンジニアリングブログ:https://engineering.mercari.com/blog/
- メルカリエンジニア向けTwitterアカウント:https://twitter.com/mercaridevjp
- 株式会社メルペイ:https://jp.merpay.com/

mercari

October 14, 2023
Tweet

More Decks by mercari

Other Decks in Technology

Transcript

  1. Takeshi Sato / 2019年にメルペイに入社し、支払いタブ画面、 E2E テストの整備、eKYC(本人確認)画面の開発を担 当。 今はTnS(Trust and Safty)という不正対策チーム

    でメルカリアプリの安全を守っている。 近著「一冊でマスター!Swift Concurrency入 門」。 株式会社メルペイ iOS Team @takeshi_sato_5203
  2. コンパイルオプション - Swift 5.6まで - OTHER_SWIFT_FLAGS = -Xfrontend -warn-concurrency -Xfrontend

    -enable-actor-data-race-checks - Swift 5.7から - SWIFT_STRICT_CONCURRENCY = {minimal|targeted|complete} - OTHER_SWIFT_FLAGS = -Xfrontend -enable-actor-data-race-checks https://forums.swift.org/t/concurrency-in-swift-5-and-6/49337
  3. Swift Concurrency対応プロジェクト - Merpay iOSコードにSwift Concurrencyのビルドオプションを追加 - Swift 6で必須になるConcurrency対応の事前準備 -

    Sendableエラーが出ないようにする - コンパイルチェックで並行処理関連の不具合を減らす
  4. 当初のロードマップ - それぞれのFeatureモジュール対応 - 各モジュールにビルドオプション渡す - 全部で20以上のモジュール - ビルドエラーを直す -

    Concurrency起因のワーニングをなるべく修正 - 対応終わったモジュールからリリース - その後Coreモジュールを対応
  5. メルペイ画面をSwiftUIに書き換え - Gitリポジトリ統合の後メルペイ画面をSwiftUIとGround UP App アーキテクチャに書き換えるプロジェクトが発足 - 今までの画面はレガシーコードとして保守することになった - Swift

    Concurrency対応はレガシーコードを対象 レガシーコード - UIKit - MVVMアーキテクチャ - なるべく更新しない方針 Ground UP App アーキテクチャ - SwiftUI - CombineによるGround UP App アーキテクチャ - 新規画面はこちらで実装
  6. チームとしての判断 - レガシーコードの積極的な更新はするべきではない - Swift Concurrency対応コードに不具合が多く見つかっている - Swift 6がリリースされてもしばらくはSwift 5モードでコンパイルする

    手段が提供される見込み - もちろんSwift 6のどこかのバージョンでこの機能がなくなる可 能性あり - Xcode 14.1, Swift 5.7ではWKNavigationDelegate, AVFoundationなどConcurrency未対応のクラスやフレームワーク 多い - SwiftUI書き換えプロジェクトの後でよい https://forums.swift.org/t/concurrency-in-swift-5-and-6/49337