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

【SwiftUI + SwiftData】List の一つの View だけを #Preview で簡単に表示したい。

Last updated at Posted at 2024-07-25

よくある List 的な View。

sc 2024-07-25 at 19.21.21.gif

この 一つのアイテムの View を #Preview で簡単に表示したい。

🤔 使い方

一つ入れ子でクロージャ。

#Preview {
  PreviewOneModelView { item in
    ItemView(item: item)
  }
  .modelContainer(for: Item.self)
}

🤔 引用

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