3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

はじめに

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より前で同じ動きを実装したい場合、下記の記事が参考になります。

3
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
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?