Posts

Post not yet marked as solved
2 Replies
309 Views
I've a workspace with multiple packages, and due to the a bug in Xcode I cannot export the app localizations using the Xcode GUI tool, but I need to resort on using a command from terminal xcodebuild -exportLocalizations -localizationPath . -workspace <path_workspace> -sdk iphoneos -exportLanguage en One of my packages contains some macros, and I use them from my code without any problem, the code compile But when I try to export localizations using that command, the build fails due to "compiler plugin not loaded" So I cannot use Xcode normal exporting because Xcode bug, and cannot export by running a command due to the macro problem What should I do? It is very discouraging this situation, do you have any suggestion? I've found a similar problem
Posted
by Playrom.
Last updated
.
Post not yet marked as solved
1 Replies
207 Views
When using as a State in view that contains a class object (as an example an Enum with associated values, or directly the class as a nillable state): When the body will trigger a state change, that should deallocate that object (as an example setting the enum to another value that do not contains the object as the associated value, or setting the state class to nil), the object is not deallocated If then the state change another time, setting the state to a third different value (ex: setting enum to a third case) the class object will be then deallocated. In case of not passing through a third state (ex. alternating nil and not nil object) the first object will be deallocated just before the new one is initiated. This behaviour is not consistent with Swift memory retain system, State apparently is masking a retain inside its implementation, and no documentation appears to show this problem I may suppose that the problem may due to the "onChange" modifier that will advertise a view of its old and new values, so state may retain the old class until the onChange is fired, but it should be smarter then the current behaviour Any suggestions for a workaround? radar filed as FB13614543 You can reproduce using the following code class MyClass { init() { print("Allocate") } deinit { print("Deallocate") } } enum LocalState { case normal case withClass(MyClass) case third } struct ContentView: View { @State var localState: LocalState = .normal @State var oldState: LocalState? var body: some View { switch localState { case .normal: Button("Go To Class") { self.localState = .withClass(MyClass()) } case .withClass: Button("Go To Third") { self.localState = .third } case .third: Button("Go To Normal") { self.localState = .normal } } } } @main struct DemoApp: App { var body: some Scene { WindowGroup { ContentView() } } }
Posted
by Playrom.
Last updated
.
Post not yet marked as solved
1 Replies
442 Views
I've encountered a problem which I don't know if is related to swiftui, the observation framework, or both If I run the following code I have two tabs, with the second tab that use a "lazy model" which is deallocated each time disappears (this is necessary for my use case) If I switch to the second tab, all works right. If I return to the first tab, the onDisappear on the foo view should force the "Bar" variable to nil , because the FooView may be still allocated (it is a tab bar) but that resource should be released If that bar variable is set to nil, the MyBar should be replaced by the ProgressView in the "background" I expect regarding that the Bar that: the instance is nil on Foo no other view should be shown with that instance (MyBar is now disappeared) Because no ref, the Bar observable object should be now deallocated In reality the Bar object is still in my memory graph Any suggestions? is it a bug? @Observable class Bar { var hello: String = "" } struct Foo: View { @State var bar: Bar? @ViewBuilder private var content: some View { if let bar { MyBar(bar: bar) } else { ProgressView() } } var body: some View { content .onAppear { bar = Bar() } .onDisappear { self.bar = nil } } } struct MyBar: View { @Bindable var bar: Bar var body: some View { Text("MyBar") } } struct ContentView: View { @State var tag: Int = 0 var body: some View { TabView(selection: $tag) { Text("First") .tag(0) .tabItem { Text("First") } Foo() .tag(1) .tabItem { Text("Foo") } } } }
Posted
by Playrom.
Last updated
.
Post not yet marked as solved
0 Replies
402 Views
Hi, When defining a KeyFrameAnimation with spring tracks, the animation do not complete until the very end , but, as default when using withAnimation with a spring animation, it will start the next animation For example if a complete spring animation is 600ms, the next animation may start only after 300ms My designer has given me the mass, stiffness, and dumping values for the animation, and expects that the animation will perform for X time, and after that a new animation will start, as it occurs on figma Using withAnimation with completition callback i can replicate the behaviour, using the ".removed" CompletitionCriteria, but i'd rather use the new KeyFrame phase animator, because i'm not very confident having 5-6 animations started recursively with "withAnimation"
Posted
by Playrom.
Last updated
.