以下の内容はhttps://tokizuoh.hatenablog.com/entry/2025/06/23/210924より取得しました。


SwiftUI未使用API100本ノック: 86. contentMargins(_:_:for:)

API

developer.apple.com

iOS 17+。指定した場所のcontent marginなるものを設定できる。scroll content, scroll indicatorに対してmarginを付与できる

スクリーンショット

水平方向のscroll contentのmarginをつけてみた。

コード

gist.github.com

メモ

これ結構便利と思う。大体のアプリのscroll viewの中身は左右にpadding設定していると思う。このAPIを使うことで親側で設定して、個は左右paddingなくせる気がする。




以上の内容はhttps://tokizuoh.hatenablog.com/entry/2025/06/23/210924より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14