エントリーの編集
エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
Initialize @StateObject with a parameter in SwiftUI
記事へのコメント0件
- 注目コメント
- 新着コメント
このエントリーにコメントしてみましょう。
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています
- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
Initialize @StateObject with a parameter in SwiftUI
I would like to know if there is currently (at the time of asking, the first Xcode 12.0 Beta) a w... I would like to know if there is currently (at the time of asking, the first Xcode 12.0 Beta) a way to initialize a @StateObject with a parameter coming from an initializer. To be more specific, this snippet of code works fine: struct MyView: View { @StateObject var myObject = MyObject(id: 1) } But this does not: struct MyView: View { @StateObject var myObject: MyObject init(id: Int) { self.myObje