Post

Replies

Boosts

Views

Activity

Custom PinnedScrollableViews
In a simple scenario, it's possible to have a ScrollView that contains a LazyVStack where the headers or footers of Section gets pinned to the top safe area. In a more complicated scenario, where The ScrollView needs to ignore the top safe area The navigation bar is hidden until a certain view, call it Foo, has gone behind what used to be the top safe area, i.e., only about 100p of the view is visible which would be invisible if the navigation bar wasn't transparent/hidden. The navigation bar becomes visible once Foo is scrolled up to a threshold that was explained earlier A second view, call is Bar, that's positioned below Foo, should never go behind the navigation bar, i.e., it should be pinned to the bottom of the navigation bar I managed to achieve this behaviour by having a State for the ignored safe area edges that gets updated based on how far Foo is scrolled. However, I get a jumpy behaviour because the ScrollView tries to adjust its contentOffset/contentInset based on the new top safe area. This jumpy behaviour is very hard to compensate especially when user scrolls very fast. In UIKit, I could achieve this behaviour by overriding viewSafeAreaInsetsDidChangeand tweaking the contentInset, and contentOffset on a collection/table view. Maybe I need to rethink my approach in a declarative way that aligns better with SwiftUI. Any thoughts on how to achieve this?
Topic: UI Frameworks SubTopic: SwiftUI
4
1
185
Jun ’26
AutoFill issue on iOS for getting phone numbers from the Contacts app
In WWDC2020, a new feature was introduced in which the app can get Contact AutoFill by setting the Content Type of a UITextFiled. This feature works on iOS 14.5 when the Content Type is set to email address but doesn't work for phone number. Here's the two changes I'm making in my code: textField.keyboardType = .phonePad textField.textContentType = .telephoneNumber Is there anything else that needs to be done or this is a known bug.
3
0
3.2k
Sep ’21
Custom PinnedScrollableViews
In a simple scenario, it's possible to have a ScrollView that contains a LazyVStack where the headers or footers of Section gets pinned to the top safe area. In a more complicated scenario, where The ScrollView needs to ignore the top safe area The navigation bar is hidden until a certain view, call it Foo, has gone behind what used to be the top safe area, i.e., only about 100p of the view is visible which would be invisible if the navigation bar wasn't transparent/hidden. The navigation bar becomes visible once Foo is scrolled up to a threshold that was explained earlier A second view, call is Bar, that's positioned below Foo, should never go behind the navigation bar, i.e., it should be pinned to the bottom of the navigation bar I managed to achieve this behaviour by having a State for the ignored safe area edges that gets updated based on how far Foo is scrolled. However, I get a jumpy behaviour because the ScrollView tries to adjust its contentOffset/contentInset based on the new top safe area. This jumpy behaviour is very hard to compensate especially when user scrolls very fast. In UIKit, I could achieve this behaviour by overriding viewSafeAreaInsetsDidChangeand tweaking the contentInset, and contentOffset on a collection/table view. Maybe I need to rethink my approach in a declarative way that aligns better with SwiftUI. Any thoughts on how to achieve this?
Topic: UI Frameworks SubTopic: SwiftUI
Replies
4
Boosts
1
Views
185
Activity
Jun ’26
AutoFill issue on iOS for getting phone numbers from the Contacts app
In WWDC2020, a new feature was introduced in which the app can get Contact AutoFill by setting the Content Type of a UITextFiled. This feature works on iOS 14.5 when the Content Type is set to email address but doesn't work for phone number. Here's the two changes I'm making in my code: textField.keyboardType = .phonePad textField.textContentType = .telephoneNumber Is there anything else that needs to be done or this is a known bug.
Replies
3
Boosts
0
Views
3.2k
Activity
Sep ’21