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

Sansan アプリで学ぶ iOS 13 対応 / Compatibility with iOS 13 on Sansan App

Sansan
September 24, 2019

Sansan アプリで学ぶ iOS 13 対応 / Compatibility with iOS 13 on Sansan App

■イベント
After iOSDC Japan 2019
https://zozotech-inc.connpass.com/event/141268/

■登壇概要
タイトル:
Sansan アプリで学ぶ iOS 13 対応
登壇者:
Sansan事業部 プロダクト開発部 中川 泰夫

※アニメーション付きは以下にてご覧いただけます。
https://ynakagawa33.github.io/After_iOSDC_JAPAN_2019/Slide.html#1

Sansan

September 24, 2019
Tweet

More Decks by Sansan

Other Decks in Technology

Transcript

  1. Sansan アプリで学ぶ iOS 13 対応 After iOSDC JAPAN 2019 Sansan

    株式会社 Sansan 事業部 プロダクト開発部 中川 泰夫
  2. アジェンダ 1. 何故やるのか? 2. Sansan アプリを iOS 13 上で実⾏出来るようになるまでに 起こった問題

    3. Sansan アプリを iOS 13 上で実⾏出来るようになった後に 起こった問題 4. まとめ
  3. 何故やるのか? Starting April 2020, all new app updates will neet

    to be built with the iOS 13 SDK and support the all-screen design of iPhone Xs Max or later. (2020年4⽉以降、新規Appと、Appのアップデートのすべて をiOS 13 SDKでビルドし、iPhone XS Max以降のオールスク リーンデザインをサポートする必要があります。)
  4. iOS 13 SDK 対応に向けて 1. macOS Catalina Beta にアップデート 2.

    Xcode 11 をダウンロード 3. iOS 13 SDK でビルドしてみる
  5. iOS 13 SDK 対応に向けて 1. macOS Catalina Beta にアップデート 2.

    Xcode 11 をダウンロード 3. iOS 13 SDK でビルドしてみる
  6. XLActionController が Swift 5.1 でコンパイルできない ビルドログを⾒ると、 /XLActionController/Resource/ActionCell.xib が コンパイル出来ていない模様 master

    ブランチに対して Xcode 11 beta 5 でビルドできるようにする 修正の PR がマージ済み https://github.com/xmartlabs/XLActionController/pull/123
  7. アプリを動かしてみる on iOS SDK 13 2019-09-22 17:26:41.737974+0900 Sansan[32738:933703] *** Terminating

    app due to uncaught exception 'RLMException', reason: 'Primary key property 'id' does not exist on object 'User''
  8. Realm のプライマリーキープロパティがオブジェクトに存在しない v3.18.0 にて Xcode 11 での互換性が追加されていた コミットログを⾒るに Swift 5.1

    で明⽰的に String 型の インスタンス変数名が設定されなくなったために、 Primary key property を String 型で定義していた場合に パースできず、例外が発⽣する模様 (User オブジェクトの id プロパティは String 型だった)
  9. Realm のプライマリーキープロパティがオブジェクトに存在しない Cartfile --- - github "realm/realm-cocoa" == 3.15.0 +

    github "realm/realm-cocoa" == 3.18.0 carthage update --platform iOS --no-use-binaries ⌘+R
  10. Modal on Modal でナビゲーションバーの初回表⽰がおかしくなる 初回表⽰の View Hierarchy を⾒ると、 UINavigationBar の⾼さは

    56 しかし、内部の _UIBarBackground や _UINavigationBarContentView の⾼さは 44 この両者の差分、 12 が余⽩となって表⽰されてしまう 2 回⽬以降はすべて 56 で同じ
  11. Modal on Modal でナビゲーションバーの初回表⽰がおかしくなる 試してみたのは以下 UINavigationBar の BarTint と同じ⾊を Background

    に 設定して、ごまかす ナビゲーションバーの影がない場合にしか有効でない なんとか、初回のみ UINavigationBar の⾼さを変えられ ないか? カスタムしたナビゲーションバーを準備すれば、⾏けそ うだが、個別の OS 対応のみでそこまで出来ない… 結局、セミモーダルをやめる (従来通り)
  12. Modal on Modal でナビゲーションバーの初回表⽰がおかしくなる - <segue destination="DhH-aq-dt8" kind="presentation" identifier="ShowWorkingCountry" id="iFe-jJ-NaI"/>

    + <segue destination="DhH-aq-dt8" kind="presentation" identifier="ShowWorkingCountry" modalPresentationStyle="fullScreen" modalTransitionStyle="coverVertical" id="iFe-jJ-NaI"/> 遷移元も遷移先もセミモーダルをやめると従来の表⽰と同等に
  13. ログイン時の遷移アニメーションがおかしい 検証した感じ、セミモーダル上での push 遷移のアニメーシ ョンがイケてない 出来そうな解決策は 3 つ セミモーダル上でも違和感のない push

    遷移⽤のカスタム アニメーションを作る セミモーダルをやめる (従来通り) push 遷移のアニメーションを無効にして、セミモーダル の⾮表⽰アニメーションを活かす
  14. ログイン時の遷移アニメーションがおかしい 検証した感じ、セミモーダル上での push 遷移のアニメーシ ョンがイケてない 出来そうな解決策は 3 つ セミモーダル上でも違和感のない push

    遷移⽤のカスタム アニメーションを作る セミモーダルをやめる (従来通り) push 遷移のアニメーションを無効にして、セミモーダル の⾮表⽰アニメーションを活かす
  15. UINavigationBar.titleView に UISearchBar を設定した場合に 制約が効かなくなった 元々、 iOS 11 で UISearchBar

    の⾼さが 56 になり、 UINavigationBar の⾼さが⼦ビューに合わせて、 56 になった ことに対する対応として、以下のコードがあった if #available(iOS 11.0, *) { searchBar.heightAnchor.constraint(equalToConstant: 44).isActive = true }
  16. UINavigationBar.titleView に UISearchBar を設定した場合に 制約が効かなくなった iOS 12 までは設定した制約が Intrinsic Content

    Size より 優先されていた iOS 13 から設定した制約より Intrinsic Content Size が優 先されるようになった
  17. UINavigationBar.titleView に UISearchBar を設定した場合に 制約が効かなくなった ⾊々、試したが以前と同じく 44 を設定できたのは以下の⽅法 Intrinsic Content

    Size が設定されていない UIView でラップ UISearchBar の translatesAutoresizingMaskIntoConstraints を false にする UINavigationBar.titleView にはラップした UIView を設定 viewDidLayoutSubviews で制約を設定
  18. UINavigationBar.titleView に UISearchBar を設定した場合に 制約が効かなくなった if #available(iOS 11.0, *) {

    searchBar.heightAnchor.constraint(equalToConstant: 44).isActive = true } navigationItem.titleView = searchBar + if #available(iOS 13.0, *) { + searchBar.translatesAutoresizingMaskIntoConstraints = false + titleView.addSubview(searchBar) + navigationItem.titleView = titleView + } 続く
  19. + override func viewDidLayoutSubviews() { + if #available(iOS 13.0, *)

    { + // 各 UI の幅取得は省略 :bow: + let titleViewWidth = navigationBarWidth - (leftBarButtonItemWidth + rightBarButtonItemWidth) + titleView.widthAnchor.constraint(equalToConstant: titleViewWidth).isActive = true + titleView.heightAnchor.constraint(equalTo: searchBar.heightAnchor).isActive = true + titleView.centerYAnchor.constraint(equalTo: searchBar.centerYAnchor).isActive = true + titleView.leadingAnchor.constraint(equalTo: searchBar.leadingAnchor).isActive = true + titleView.trailingAnchor.constraint(equalTo: searchBar.trailingAnchor).isActive = true + } + + super.viewDidLayoutSubviews() + }
  20. まとめ iOS 13 SDK でビルドと実⾏に成功するところまでは以前の iOS 12 SDK のアップデート時とそこまで変わらなかった 実際に

    iOS 13 SDK でビルドしたアプリを iOS 13 上で動か すと様々な問題が発⽣した すべての画⾯をテストできたわけではないので、まだある かも…