LoginSignup
2
1

More than 1 year has passed since last update.

【SwiftUI】HomeIndicatorを非表示にする

Posted at

はじめに

iOS16からHomeIndicatorを非表示にする機能がSwiftUIの公式のAPIとして提供されました。
使ってみたので記録しておきます。

HomeIndicatorとは

ホームボタンのない端末で下の方に表示される棒です。
IMG_1758.PNG

動画

ちょっとわかりにくいですが、下の棒が消えています。
Simulator Screen Recording - iPhone 14 - 2022-12-10 at 21.00.04.gif

実装

import SwiftUI

struct ContentView: View {
    var body: some View {
        VStack {
            Image(systemName: "globe")
                .imageScale(.large)
                .foregroundColor(.accentColor)
            Text("Hello, world!")
        }
+       .persistentSystemOverlays(.hidden)
    }
}

おわり

iOS16より前で同じ動きを実装したい場合、下記の記事が参考になります。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1