Post

Replies

Boosts

Views

Activity

Reply to Xcode 14.0 Crashes when Opening Storyboard Interface Builder
I have the same issue in a project with 8 storyboards. All are displayed fine but one. When I try to load this particular storyboard Xcode just crash. This happens on Xcode 14 and Xcode 14.1 RC. Works fine on Xcode 13.4.1. Anybody else experienced Xcode 14 crashing issues when opening a particular storyboard? Attached one of Xcode crash log. Xcode-2022-10-31-223133.ips Thank you
Nov ’22
Reply to iOS 16 UITextView line spacing when empty
After some research I found out (thanks to the following post) that in iOS 16 UITextView use Text Kit 2. Unfortunately the new implementation has the issue described above, but it's possibile to force an UITextView to fallback to Text Kit 1 by accessing the layoutManager property (thanks to winshy for this solution). So, in order to fix the issue you just need to add the following line: _ = textView.layoutManager The full code of the original example will become: class ViewController: UIViewController { @IBOutlet weak var textView: UITextView! { didSet { _ = textView.layoutManager var attributes = [NSAttributedString.Key: Any]() let paragraphStyle: NSMutableParagraphStyle = NSMutableParagraphStyle() paragraphStyle.lineSpacing = 50 attributes[NSAttributedString.Key.paragraphStyle] = paragraphStyle attributes[NSAttributedString.Key.font] = UIFont.preferredFont(forTextStyle: .body) textView.typingAttributes = attributes } } }
Topic: UI Frameworks SubTopic: UIKit Tags:
Aug ’22
Reply to MKErrorDomain 4 when performing a MKLocalSearch with an MKLocalSearchCompletion
Just want to add some new information. I'm using the same exact code on two different apps and on the same device. With the exact same search term in one app I successfully receive an MKLocalSearch.Response but in the other one I receive an MKError.placemarkNotFound error. Why the same code, on the same device with the same search term but on different apps give a different result? The only notable difference between the apps is that the one that give the error is targeting iOS 15. The one that works is targeting iOS 13. Please also note that I receive the error only for some particular search terms. These particular search terms always fails. Other search terms successufly return a valid MKLocalSearch.Response. I receive the error on both physical device and simulator.
Topic: UI Frameworks SubTopic: UIKit Tags:
Jun ’22
Reply to PHCloudIdentifier without photo library access prompt
Thank you for the answer.  I’m developing a CoreData application that allow the user to store data and pictures. The app is doing some local backups of the CoreData store. Since pictures can make the store very large I just backup the data of the store without the pictures (I keep only the assetIdentifier).  If for some reason the user need to restore the data from a backup, the app will try to look for the original pictures in the user library using the asset identifiers. This is working fine if the user is restoring the data on the same device, but if the backup is restored on another device the local identifiers become useless. The idea was to also store the cloud identifier so that the restore procedure has a chance to find the original pictures also on a different device.  Now, I really don’t want to ask user to grant library access during the normal use of the app. Access will be requested only in the rare case that a restore is required. Personally, I would love to receive the cloud identifier directly inside the PHPickerResult like the assetIdentifier.  What do you think about it?
Topic: UI Frameworks SubTopic: UIKit Tags:
Jan ’22
Reply to Inset grouped table cells not aligned with large title
Frameworks Engineer's answer put me on the right track to find a fix. The problem actually appears to be the value returned by layoutMargins. On an iPhone 12 and on an iPhone 8 the distance between the edge of the device and the large title is the same (16px). The problem is that the value returned by layoutMargins.left is different on the two devices. On the iPhone 8 is 16px (the correct value to align the cells with the title) while on the iPhone 12 is 20px (4 pixels too much, causing the misalignment). I tried to manually set the layoutMargins property and discovered that for some reason if you set the layoutMargins to zero then the issue disappears. After settings layoutMargins to zero then layoutMargins.left will return 16px on both devices, making a perfect alignment. override func viewDidLoad() { super.viewDidLoad()    tableView.layoutMargins = .zero }
Topic: UI Frameworks SubTopic: UIKit Tags:
Jan ’22
Reply to Xcode 14.0 Crashes when Opening Storyboard Interface Builder
I have the same issue in a project with 8 storyboards. All are displayed fine but one. When I try to load this particular storyboard Xcode just crash. This happens on Xcode 14 and Xcode 14.1 RC. Works fine on Xcode 13.4.1. Anybody else experienced Xcode 14 crashing issues when opening a particular storyboard? Attached one of Xcode crash log. Xcode-2022-10-31-223133.ips Thank you
Replies
Boosts
Views
Activity
Nov ’22
Reply to iOS 16 UITextView line spacing when empty
After some research I found out (thanks to the following post) that in iOS 16 UITextView use Text Kit 2. Unfortunately the new implementation has the issue described above, but it's possibile to force an UITextView to fallback to Text Kit 1 by accessing the layoutManager property (thanks to winshy for this solution). So, in order to fix the issue you just need to add the following line: _ = textView.layoutManager The full code of the original example will become: class ViewController: UIViewController { @IBOutlet weak var textView: UITextView! { didSet { _ = textView.layoutManager var attributes = [NSAttributedString.Key: Any]() let paragraphStyle: NSMutableParagraphStyle = NSMutableParagraphStyle() paragraphStyle.lineSpacing = 50 attributes[NSAttributedString.Key.paragraphStyle] = paragraphStyle attributes[NSAttributedString.Key.font] = UIFont.preferredFont(forTextStyle: .body) textView.typingAttributes = attributes } } }
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Aug ’22
Reply to MKErrorDomain 4 when performing a MKLocalSearch with an MKLocalSearchCompletion
Just want to add some new information. I'm using the same exact code on two different apps and on the same device. With the exact same search term in one app I successfully receive an MKLocalSearch.Response but in the other one I receive an MKError.placemarkNotFound error. Why the same code, on the same device with the same search term but on different apps give a different result? The only notable difference between the apps is that the one that give the error is targeting iOS 15. The one that works is targeting iOS 13. Please also note that I receive the error only for some particular search terms. These particular search terms always fails. Other search terms successufly return a valid MKLocalSearch.Response. I receive the error on both physical device and simulator.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to PHCloudIdentifier without photo library access prompt
Thank you for the answer.  I’m developing a CoreData application that allow the user to store data and pictures. The app is doing some local backups of the CoreData store. Since pictures can make the store very large I just backup the data of the store without the pictures (I keep only the assetIdentifier).  If for some reason the user need to restore the data from a backup, the app will try to look for the original pictures in the user library using the asset identifiers. This is working fine if the user is restoring the data on the same device, but if the backup is restored on another device the local identifiers become useless. The idea was to also store the cloud identifier so that the restore procedure has a chance to find the original pictures also on a different device.  Now, I really don’t want to ask user to grant library access during the normal use of the app. Access will be requested only in the rare case that a restore is required. Personally, I would love to receive the cloud identifier directly inside the PHPickerResult like the assetIdentifier.  What do you think about it?
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to Inset grouped table cells not aligned with large title
Frameworks Engineer's answer put me on the right track to find a fix. The problem actually appears to be the value returned by layoutMargins. On an iPhone 12 and on an iPhone 8 the distance between the edge of the device and the large title is the same (16px). The problem is that the value returned by layoutMargins.left is different on the two devices. On the iPhone 8 is 16px (the correct value to align the cells with the title) while on the iPhone 12 is 20px (4 pixels too much, causing the misalignment). I tried to manually set the layoutMargins property and discovered that for some reason if you set the layoutMargins to zero then the issue disappears. After settings layoutMargins to zero then layoutMargins.left will return 16px on both devices, making a perfect alignment. override func viewDidLoad() { super.viewDidLoad()    tableView.layoutMargins = .zero }
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Jan ’22