Post

Replies

Boosts

Views

Activity

No Start/End Haptics when scrolling through List on watchOS
I have a basic List made in SwiftUI. When I scroll with the Digital Crown I get the "light haptics" however when I get to the top or bottom of the list I don't get the more pronounced dent. Update - If I use a plain list style then I get the haptics as expected. However it should work with the elliptical style as this is used in the system. The console outputs the following 2022-05-19 23:32:53.782614+0200 WatchApp WatchKit Extension[326:41020] [default] Error: Error Domain=NSOSStatusErrorDomain Code=-536870187 "(null)" 2022-05-19 23:32:53.783181+0200 WatchApp WatchKit Extension[326:41020] [detents] could not play detent NO, 2, Error Domain=NSOSStatusErrorDomain Code=-536870187 "(null)", (         {         Gain = "0.01799999922513962";         OutputType = 0;         SlotIndex = 4;     },         {         Gain = "0.4900000095367432";         OutputType = 1;         SlotIndex = 5;     } ) Here is my code struct ContentView: View {     var body: some View {             List {                                  ForEach(0..<100) { i in                                         NavigationLink(destination: FeedView()) {                         Text("Hello")                     }                 }                              }.navigationTitle("Title")         } }
0
1
1.4k
May ’22
Recreate watchOS App Store Scroll Style
I'm trying to recreate the watchOS App Store layout however there are a few parts I am not how to recreate. When scrolling an Elliptical Style List the cells will "snap" up if you are scrolling slowly. This effect works well with regular size cells with just a line of text but makes the List scrolling seem a glitchy when the cells are taller. In the App Store app this "snap" effect is not there. When scrolling there is still a visible "Elliptical Scroll Style" but this effect is missing for the "See All" cells which scroll as if it were a "Plain Style List". How would you create this effect? Also when using a Plain Style List and you scroll to the very top or bottom you get a "heavy" haptic feedback which is absent on Elliptical Style Lists. The App Store app still has this "heavy" haptic feedback when you get to the top or bottom yet it uses an Elliptical List style (or at least something in between as explained above.)
0
0
1.3k
May ’22
CollectionView Cell size only updating after Scroll
In my collection view I have an image with some text below. I have a height constraint for the image view so the image aspect ratio can be adjusted (cells are the width of the screen). I set the constraint constant in cellForItemAt. The cell heights only resize correctly after I scroll. CollectionViewController     override func viewDidLoad(_ animated: Bool) {         super.viewDidLoad(animated)         let layout = collectionView.collectionViewLayout         if let flowLayout = layout as? UICollectionViewFlowLayout {             flowLayout.estimatedItemSize = CGSize(width: collectionView.widestCellWidth, height: 800)         }     }     override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {         let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as! selectCell         cell.setupView() // Image resolution is already downloaded         let gsReference = storage.reference(forURL: thumbnail.storageLocation)         cell.imageView.sd_setImage(with: gsReference, placeholderImage: nil)         cell.layoutIfNeeded()         cell.layoutSubviews()         return cell     } selectCell.swift     override func systemLayoutSizeFitting(_ targetSize: CGSize, withHorizontalFittingPriority horizontalFittingPriority: UILayoutPriority, verticalFittingPriority: UILayoutPriority) -> CGSize {         var targetSize = targetSize         targetSize.height = CGFloat.greatestFiniteMagnitude         let size = super.systemLayoutSizeFitting(targetSize, withHorizontalFittingPriority: .required, verticalFittingPriority: .fittingSizeLevel)         return size     }     func setupView() { // Changing the labels size the cell correctly when first loaded             titleLbl.text = ""             descriptionLbl.text = ""                          let imageAspectRatio = CGFloat(metadata.thumbnail.width) / CGFloat(metadata.thumbnail.height)             let imageViewHeight = containerView.frame.width / imageAspectRatio             imageViewHeightConstraint.constant = imageViewHeight             self.contentView.setNeedsLayout()             self.contentView.layoutIfNeeded()     }
0
0
1.5k
Aug ’22
How to add Apple Music style filters to Search Controller?
I’m trying to add a search filter UI like the one used in the Music app. I’ve tried to add a reusable view to the search controller collection view but there seems to be padding around it. My plan was just to add a Collection View there and try recreate the animation used. I tried scope buttons but those are a segment control, so they only hold a few options.
0
0
772
Oct ’22
How to save login details to Keychain?
In my app user accounts are handled with Firebase Auth. When creating a user how can I get the system to suggest a Unique password (that prompt that comes up on the keyboard) and also how can i get it to save these details to the keychain. My app will have a website in the future so I want the details come up when the user tries to login there. When the user logs in i used the func below to save the details to the keychain, it says the details have been saved but it doesnt seem to come up in the passwords tab in Settings. func saveCredentialsToKeychain(email: String, password: String) { let query: [String: Any] = [ kSecClass as String: kSecClassInternetPassword, kSecAttrServer as String: "myWebsite.com", kSecAttrAccount as String: email, kSecValueData as String: password.data(using: .utf8)!, kSecAttrAccessible as String: kSecAttrAccessibleWhenUnlocked ] let status = SecItemAdd(query as CFDictionary, nil) if status == errSecSuccess { print("Credentials saved to Keychain") } else { print("Error saving credentials to Keychain: \(status)") } }
0
0
803
Nov ’23