Posts

Post not yet marked as solved
6 Replies
It works for me on very simple views like this, where the button brings the TextEditor into focus as expected. struct ContentView: View {     @State var tempField: String = ""     @State var isShowingSheet: Bool = false          @FocusState var isFocused: Bool          var body: some View {         VStack {             TextEditor(text: $tempField)                 .padding()                 .focused($isFocused)             Button(action: {isFocused = true})             {                 Text("Focus!")             }         }     } } Put them both in a sheet however, and it doesn't work anymore. struct ContentView: View {     @State var tempField: String = ""     @State var isShowingSheet: Bool = false          @FocusState var isFocused: Bool          var body: some View {         VStack {             Button(action: {self.isShowingSheet = true}) {                 Text("Sheet!")             }.sheet(isPresented: $isShowingSheet) {                 TextEditor(text: $tempField)                     .padding()                     .focused($isFocused)                 Button(action: {isFocused = true})                 {                     Text("Focus!")                 }             }         }     } } I've also submitted feedback FB9166651.
Post not yet marked as solved
24 Replies
Sorry for asking this newbie question. Let's consider a basic contact list app:Say I have a list of "Row" elements displaying only a photo and First Name. Tapping on a row will take you to a "Detail" page that shows other data like last name and date of birth.Am I supposed to create two separate viewmodels - one for the "Row" view and another for the "Detail" view?If so, should I be initialising two separate arrays of these when the app loads (and the dataStore gets initialised in SceneDelegate.swift)?When a user is in editing mode in the "Detail" page, is the SwiftUI View "allowed' to call methods in the dataStore class directly? It seems very easy to do this with when I can set the dataStore as an @EnvironmentObject variable.I'm super new to MVVM and would appreciate any form of guidance.
Post not yet marked as solved
31 Replies
I can't seem to re-activate a modal after dismissing it with a swipe down gesture (Not sure if this is related to "No dismiss modal programatically available", apologies if it is).Force-quitting the app makes the modal available again.