Post

Replies

Boosts

Views

Activity

Reply to SwiftUI App crashes while switching orientation
Here is the Home view... struct HomeView: View { @Namespace var namespace var homeWidgetConfigurations = LoadHomeWidgetConfigurations() @State private var scale: CGFloat = 1.0 @State private var offset: CGFloat = 0 @Environment(.colorScheme) private var deviceColorScheme var body: some View { GeometryReader { geometry in VStack { NavigationStack { ScrollView { Label("Home", systemImage: "house.fill") .font(.title2) .fontWeight(.bold) .foregroundColor(deviceColorScheme == .light ? .black : .black) .padding() .background( LinearGradient(gradient: Gradient(colors: [deviceColorScheme == .light ? .gray : .white, deviceColorScheme == .light ? .yellow : .yellow]), startPoint: .top, endPoint: .bottom) ) .cornerRadius(10) Text("") ForEach(homeWidgetConfigurations, id: \.id) { image in NavigationLink(value: image) { WidgetsView(widget: image) .matchedTransitionSource(id: image.id, in: namespace, configuration: { source in source .background(Color.yellow) .clipShape(RoundedRectangle(cornerRadius: 20)) }) } .clipShape(RoundedRectangle(cornerRadius: 10)) .shadow(radius: 10) .shadow(radius: 15) .shadow(radius: 20) .shadow(radius: 20) .shadow(radius: 20) .shadow(radius: 20) .shadow(radius: 20) .padding(.horizontal, 7) } } .navigationDestination(for: HomeViewWidgetItem.self) { item in DismissableView { if (item.title == "Entertainment"){ EntertainmentView() .navigationTransition(.zoom(sourceID: item.id, in: namespace)) } else if (item.title == "News"){ NewsHomeView() .navigationTransition(.zoom(sourceID: item.id, in: namespace)) } else{ Text ("In Dismissable View") } } } } } //end of VStack } //end of Geometry }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Nov ’24
Reply to SwiftUI App crashes while switching orientation
hmm... try it and you will know why I did what I did. And. question is not that why I did, point is it breaks swiftUI app.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’24
Reply to SwiftUI App crashes while switching orientation
Here is the Home view... struct HomeView: View { @Namespace var namespace var homeWidgetConfigurations = LoadHomeWidgetConfigurations() @State private var scale: CGFloat = 1.0 @State private var offset: CGFloat = 0 @Environment(.colorScheme) private var deviceColorScheme var body: some View { GeometryReader { geometry in VStack { NavigationStack { ScrollView { Label("Home", systemImage: "house.fill") .font(.title2) .fontWeight(.bold) .foregroundColor(deviceColorScheme == .light ? .black : .black) .padding() .background( LinearGradient(gradient: Gradient(colors: [deviceColorScheme == .light ? .gray : .white, deviceColorScheme == .light ? .yellow : .yellow]), startPoint: .top, endPoint: .bottom) ) .cornerRadius(10) Text("") ForEach(homeWidgetConfigurations, id: \.id) { image in NavigationLink(value: image) { WidgetsView(widget: image) .matchedTransitionSource(id: image.id, in: namespace, configuration: { source in source .background(Color.yellow) .clipShape(RoundedRectangle(cornerRadius: 20)) }) } .clipShape(RoundedRectangle(cornerRadius: 10)) .shadow(radius: 10) .shadow(radius: 15) .shadow(radius: 20) .shadow(radius: 20) .shadow(radius: 20) .shadow(radius: 20) .shadow(radius: 20) .padding(.horizontal, 7) } } .navigationDestination(for: HomeViewWidgetItem.self) { item in DismissableView { if (item.title == "Entertainment"){ EntertainmentView() .navigationTransition(.zoom(sourceID: item.id, in: namespace)) } else if (item.title == "News"){ NewsHomeView() .navigationTransition(.zoom(sourceID: item.id, in: namespace)) } else{ Text ("In Dismissable View") } } } } } //end of VStack } //end of Geometry }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’24
Reply to iOS 17 Opening the color picker results in an permanently visible PKToolBar
If it's fixed in iOS 17, then it's back in iOS 18.1. Literally ColorPicker("Pick Color", selection: $selectedColor) throws the error.
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Nov ’24