Posts

Post not yet marked as solved
7 Replies
Not working for me neighter, SwiftData do not cascade delete relationships.
Post marked as solved
8 Replies
You can temporary fix this problem via: Duplicate the WatchOS sheme and name it Preview-...... In Edit Scheme > Build Remove the iOS companion app from the list. Then switch to Preview- scheme when you want to preview the watchOS app Swift views.
Post not yet marked as solved
1 Replies
You can see the effect in following code. There are two viewModels, one using ObservableObject and second using @Observable observation framework. The tabView content views owns the viewModel, however when the parent TabView is redrawed, the ownership of @Observation is teared down and new object is recreated on every redraw of TabView @StateObject with ObservableObject maintains its view ownership and the object is not deallocated or recreated as would be expected. @State with @Observable do not follow the ownership, and new object is created every time the parent is redrawed. Following is the code: import Observation import SwiftUI /// ObservableObject, via @StateObject. class ViewModelObservable: ObservableObject { @Published public var title: String deinit { print("deinit ViewModelObservable") } init(title: String) { self.title = title print("init ViewModelObservable") } } /// New Observation framework object. @Observable class ViewModelObseration { public var title: String deinit { print("deinit ViewModelObseration") } init(title: String) { self.title = title print("init ViewModelObseration") } } struct SecondTabContentView: View { /// View Owns object (Observation Framework) @State var viewModelObservation: ViewModelObseration /// View Owns object (Observable Object) @StateObject var viewModelObservable: ViewModelObservable init() { _viewModelObservable = StateObject(wrappedValue: ViewModelObservable(title: "SecondTabContentView Observable")) _viewModelObservation = State(wrappedValue: ViewModelObseration(title: "SecondTabContentView Observation")) } var body: some View { VStack { Text(viewModelObservable.title) Text(viewModelObservation.title) } } } struct FirstTabContentView: View { /// View Owns object (Observation Framework) @State var viewModelObservation: ViewModelObseration /// View Owns object (Observable Object) @StateObject var viewModelObservable: ViewModelObservable init() { _viewModelObservable = StateObject(wrappedValue: ViewModelObservable(title: "FirstTabContentView Observable")) _viewModelObservation = State(wrappedValue: ViewModelObseration(title: "FirstTabContentView Observation")) } var body: some View { VStack { Text(viewModelObservable.title) Text(viewModelObservation.title) } } } struct ContentView: View { @State var tabSelection: Int = 1 @State var redrawTrigger: Bool = false var body: some View { TabView(selection: $tabSelection) { FirstTabContentView() .tag(0) .tabItem { Label("First \(redrawTrigger ? "true" : "false") ", systemImage: "pen") } SecondTabContentView() .tag(1) .tabItem { Label("Second \(redrawTrigger ? "true" : "false")", systemImage: "pen") } } .task { try? await Task.sleep(for: .seconds(3)) self.redrawTrigger = true try? await Task.sleep(for: .seconds(3)) self.redrawTrigger = false } } } #Preview { ContentView() }
Post marked as solved
4 Replies
My macOS application that used focusedValues that was working correctly on Big Sur, is not working on Monterrey. I am using focused values for macOS menu like passing currently active document viewModel, and the focusedValues when retrived via @FocusedValue are always nil. This breaks absolutelly the Main Menu commands on Monterrey.
Post marked as solved
9 Replies
Hello, there are currently many issues for MIDI FX Plugins and Audio Unit v3: MIDI FX Plugins do not receive the host sample rate, there is no way to inherrit or react to sample rate changes made in Logic Pro X. (This affects severly plugins that calculate midi delta using the event.sampleTime) MIDI FX Plugins that are instantiated as multiple instances on 2 or more tracks, the midi on other instances than selected track are passed and can be seen in plugin instance, however they are not played back later on instrument. This is a serious bug as If anybody instantiate Midi FX Plugin v3 on 2 or more instances, it breaks the playback of these tracks.
Post not yet marked as solved
4 Replies
I have the same issue my Midi FX plugin that is AU v3 is appearing in Logic Pro X 8 times. Anybody has any fix for that?
Post not yet marked as solved
12 Replies
Thanks for reply and the explanation, this is really great, I hope the issues will be fixed to be able to port apps to use fully SwiftUI. Something like this implementation is really needed as the responder chain do not fit the SwiftUI. Thanks.
Post marked as solved
4 Replies
Great, thank you !!!
Post not yet marked as solved
10 Replies
I have the same issue, your code is the same as mine and it just crashes. I hope it will be fixed in next beta.