Post

Replies

Boosts

Views

Activity

SwiftUI App has different behaviour depending on app "minimum deployment version" setting in Xcode
Here is a simple SwiftUI app which uses animatable protocol to show "animated dots" at the end of "loading" text. import SwiftUI @main struct MyApp: App { var body: some Scene { WindowGroup { ContentView() } } } struct ContentView: View { @State var value = 0.0 var body: some View { AnimatedLoadingText(value: value) .background(Color.orange) .animation( .default.speed(0.3).repeatForever(autoreverses: false), value: value ) .onAppear { value = 3.0 } } } struct AnimatedLoadingText: View, Animatable { var animatableData: Double init(value: Double) { self.animatableData = value } var dots: String { String(Array(repeating: ".", count: Int(round(animatableData)))) } var body: some View { Text("Loading") + Text(dots) } } The problem I am having is that this code has different behaviour solely based on "minimum deployment version" setting in Xcode. If I set minimum deployment version to iOS 16 I get "correct" animation, however by lowering the minimum deployment version to iOS 14 the Animatable protocol seems to be ignored entirely and Animation behaves differently. I am using Xcode 14.3.1 RC and running it on iPhone 14 Pro with iOS 16.5 in both cases. My question is why does it behave like this? My understanding was that changing the minimum deployment target should only change supported set of iOS versions, and behaviour of the app should depend only on iOS version that device is running and the Xcode used to build the app (iOS SDK).
0
0
480
Jun ’23