I'm creating an iOS app with SwiftUI. I'm using:
However, the app behaves different on the two devices. For example on the physical iPad, NavigationLink
can only be used once.
It is my first iOS app. So I'm wondering how these kind of errors can be circumvented or resolved?
import SwiftUI
enum ExerciseType: String, CaseIterable, Codable, Hashable {
case vowels = "Vowels"
case special = "Special Characters"
case small = "Small Characters"
case long = "Long Vovels"
}
enum LessonType: String, CaseIterable, Codable, Hashable {
case hiragana = "Introduction to Hiragana"
case katakana = "Introduction to Katakana"
case kanji = "Introduction to Kanji"
}
struct ContentView: View {
var body: some View {
NavigationView{
Form{
Section(header: Text("Default Lesson")){
List{
ForEach(LessonType.allCases, id:\.self){ lesson in
NavigationLink(destination: LessonView(), label: {Text(lesson.rawValue)})
}
}
}
}
.navigationBarTitle("iPad NavigationLink")
}.navigationViewStyle(StackNavigationViewStyle())
}
}
struct LessonView: View {
var body: some View{
Form{
List{
ForEach(ExerciseType.allCases, id:\.self){ exercise in
NavigationLink(destination: Text(exercise.rawValue), label: {Text(exercise.rawValue)})
}
}
}
}
}
The bug is fixed by Apple in iOS 13.3 beta 4. Keep in mind that iOS 13.3 was in beta at the time you tested it. It was not a bug in iOS 13.2, so this is nothing to worry about anymore.
Tested on Xcode 11.3 (11C29)
It's fixed when running on iOS 13.3 device, but not on iOS 13.3 simulator.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With