Post

Replies

Boosts

Views

Activity

Reply to Persisting scroll position when changing segment control in swiftUI
struct HomeListView:View { @State private var favoriteColor = 0 var body: some View { VStack { Picker("What is your favorite color?", selection: $favoriteColor) { Text("Red").tag(0) Text("Green").tag(1) } .pickerStyle(.segmented) .padding(EdgeInsets(top: 8, leading: 8, bottom: 8, trailing: 8)) selectedView } .navigationBarTitleDisplayMode(.inline) } @ViewBuilder var selectedView: some View { switch favoriteColor { case 0: HomeViewListing() default: TestListingView() } } } struct HomeViewListing:View { var body: some View { ScrollView { LazyVStack { ForEach(0..<100) { item in Text("\(item)") } } } .scrollIndicators(.hidden) } } struct TestListingView:View { var body: some View { ScrollView { LazyVStack { ForEach(0..<100) { item in Text("\(item)") } } } .scrollIndicators(.hidden) } } Steps to reproduce 1)Scroll HomeListingView item to 98 2)Change segment control( to TestListingView) 3)Change segment control again(to HomeListingView) Scroll position is changed now to 0 but it should be at position 98(step 1 )
Mar ’23
Reply to Force RTL support for default alerts
If your app only support RTL language then you can make you development language to Arabic and removed all localized file and Localized resources from Info.plist. Also UIView.appearence.sementicContentAttribute code. Then try to build and run. All UI and share option are in RTL. A good example is here https://ahmedk92.github.io/2018/08/10/Arabic-As-A-Default-Language-for-Your-iOS-App.html
Jul ’23