Post

Replies

Boosts

Views

Activity

Changing focus state in onSubmit causes keyboard to bounce
Is there any way to prevent the keyboard from bouncing when changing the focus state in onSubmit? Or is it not recommended to change focus in onSubmit? The following view is setup so that pressing return on the keyboard should cause focus to move between the TextFields. struct TextFieldFocusState: View { enum Field { case field1 case field2 } @FocusState var focusedField: Field? var body: some View { Form { TextField("Field 1", text: .constant("")) .focused($focusedField, equals: .field1) .onSubmit { focusedField = .field2 } TextField("Field 2", text: .constant("")) .focused($focusedField, equals: .field2) .onSubmit { focusedField = .field1 } } } } I would expect that when pressing return, the keyboard would say on screen. What actually happens is the keyboard appears to bounce when the return key is pressed (first half of gif). I assume this is because onSubmit starts dismissing the keyboard then setting the focus state causes the keyboard to be presented again. The issue doesn't occur when tapping directly on the text fields to change focus (second half of gif).
0
1
164
2w
Supporting the "Move to iOS" app on android.
We recently got a report from a user that used the "Move to iOS" on android that our app wasn't automatically installed but many others were. I was trying to find some documentation about what is required to support this an none seems to exist. All I could find is this line from the support article for the "Move to iOS" app. If they're available on both Google Play and the App Store, some of your free apps will also transfer. After the transfer completes, you can download any free apps that were matched from the App Store. https://support.apple.com/en-ca/HT201196 Our apps are free so that's not the issue. What is required from the apps or App Store entry to properly support "Move to iOS"?
1
0
671
Jun ’22
How to position a supplementary item above a background decoration item
I'm making a custom section to use in a UICollectionViewCompositionalLayout. It's supposed to look similar to a UITableViewStyle.grouped where there's a background behind the cells and a header that's above the background. The issue I'm running into is by default the NSCollectionLayoutDecorationItem.background matches size of the section, and the NSCollectionLayoutBoundarySupplementaryItem for the header extends the bounds of the section causing the background to go behind the header. If I set header.extendsBoundary = false, the header is positioned in front of the first cell in the section. So what I've been doing is setting a top content inset on the background to be equal to the estimated height of the header. background.contentInsets.top = estimatedHeaderHeight The issue is that the header height wont always match the estimated height like when the user increases their text size or the test is long enough to wrap. That causes the header height to not match the inset, the header appears to overlay the background. Any suggestions for getting the desired appearance? Here's the code I'm using to make the section layout currently.     func groupedSectionLayout(withHeader hasHeader: Bool, environment: NSCollectionLayoutEnvironment) -> NSCollectionLayoutSection {         let itemSize = NSCollectionLayoutSize(             widthDimension: .fractionalWidth(1.0),             heightDimension: .estimated(NotificationSettingSwitchCell.estimatedHeight)         )                  let item = NSCollectionLayoutItem(layoutSize: itemSize)                  let group = NSCollectionLayoutGroup.vertical(layoutSize: itemSize, subitems: [item])                  let section = NSCollectionLayoutSection(group: group)                  let background = NSCollectionLayoutDecorationItem             .background(elementKind: ListCollectionBackgroundView.kind.rawValue)                  if hasHeader {             let headerHeight = CollectionExtraSmallHeader.estimatedHeight             background.contentInsets.top = headerHeight                          let headerSize = NSCollectionLayoutSize(                 widthDimension: .fractionalWidth(1),                 heightDimension: .estimated(headerHeight)             )                          let header = NSCollectionLayoutBoundarySupplementaryItem(                 layoutSize: headerSize,                 elementKind: CollectionExtraSmallHeaderModel.kind.rawValue,                 alignment: .top             )                                      section.boundarySupplementaryItems = [header]         }                  section.decorationItems = [background]                  return section     }
1
1
1.2k
Jul ’21