Post

Replies

Boosts

Views

Activity

Reply to Mark localized strings untranslatable
Wow, not be able to opt-out strings from interface builder files is really a problem! It often happens to add elements in IB, UILabels for example, whose content is populated via code. We really need a way for specify that a particular IB item should not be localized. What is the recommended approach to handle these cases?
Aug ’23
Reply to NSDiffableDataSourceSnapshot doesn't call Hashable methods if ItemIdentifierType is class
I just ran into this issue. If I try to use a class instead of a struct as a diffable data source object, the hashable methods are not called causing issues. I haven't found anything documented about this limitation. It would be nice to get an official feedback about this. As a temporary fix, logancautrell solution works perfectly, thank you for sharing that.
Topic: UI Frameworks SubTopic: UIKit Tags:
Jul ’23
Reply to Loop through CoreData objects and memory issue
I found that a way to reclaim memory is to frequently reset the context. Since objects are invalidated after a reset, I decided to work with objects ids instead (these will remain the same after a reset). This is my new code: var objectsIds = managedObjectContext.allImages.map({$0.objectID}) for objectsIdsChunk in objectsIds.chunked(into: 100) { for objectId in objectsIdsChunk { autoreleasepool { if let image = managedObjectContext.object(with: objectId) as? Image { var imageData = image.imageData } } } managedObjectContext.reset() } This is the array chunked extension: extension Array { func chunked(into size: Int) -> [[Element]] { return stride(from: 0, to: count, by: size).map { Array(self[$0 ..< Swift.min($0 + size, count)]) } } } With this solution the memory level remain low.
Topic: Programming Languages SubTopic: Swift Tags:
Apr ’23
Reply to Crash on VectorKit (EXC_BAD_ACCESS KERN_INVALID_ADDRESS)
Some of the users of one of my app have the same exact crash. Also in my case it's a MapKit app. Tommy8, did you figure out what was the problem? This is my crash report: Thread 3 name: com.apple.vectorkit.dispatch.layoutqueue Thread 3 Crashed: 0 VectorKit 0x1ad0f8830 md::FontAtlas::freeCell(md::FontAtlasCell*) + 164 1 VectorKit 0x1ad0f8820 md::FontAtlas::freeCell(md::FontAtlasCell*) + 148 2 VectorKit 0x1ad0f7fb4 md::FontAtlas::flushOldestCell() + 104 3 VectorKit 0x1acd4f064 md::FontAtlas::finishFrame(std::__1::shared_ptr<ggl::RenderTransaction> const&) + 112 4 VectorKit 0x1acd1d89c md::LabelManager::layout(md::LayoutContext const&, md::CartographicRenderer const*, std::__1::unordered_set<std::__1::shared_ptr<md::LabelMapTile>, std::__1::hash<std::__1::shared_ptr<md::LabelMapTile> >, std::__1::equal_to<std::__1::shared_ptr<md::LabelMapTile> >, geo::StdAllocator<std::__1::shared_ptr<md::LabelMapTile>, mdm::Allocator> > const&, md::PassList&) + 2628 5 VectorKit 0x1acce723c md::LabelRenderLayer::layout(md::LayoutContext const&) + 916 6 VectorKit 0x1accec488 std::__1::__function::__func<md::CartographicRenderLayer::frame(md::LayoutContext const&)::$_0, std::__1::allocator<md::CartographicRenderLayer::frame(md::LayoutContext const&)::$_0>, void ()>::operator()() + 112 7 VectorKit 0x1accd6a00 invocation function for block in geo::TaskQueue::queueAsyncTask(std::__1::shared_ptr<geo::Task>, NSObject<OS_dispatch_group>*) + 108 8 libdispatch.dylib 0x19ae9f460 _dispatch_call_block_and_release + 32 9 libdispatch.dylib 0x19aea0f88 _dispatch_client_callout + 20 10 libdispatch.dylib 0x19aea8640 _dispatch_lane_serial_drain + 672 11 libdispatch.dylib 0x19aea91c0 _dispatch_lane_invoke + 436 12 libdispatch.dylib 0x19aeaa4a4 _dispatch_workloop_invoke + 1780 13 libdispatch.dylib 0x19aeb3e10 _dispatch_workloop_worker_thread + 652 14 libsystem_pthread.dylib 0x1e118cdf8 _pthread_wqthread + 288 15 libsystem_pthread.dylib 0x1e118cb98 start_wqthread + 8
Mar ’23
Reply to UITextView BIU button missing on iOS 16 (text formatting)
Hi Claude31. Did you set allowsEditingTextAttributes to true? When you do that, users are able to change formatting to bold, underline and italics on iPhone via the menu and on iPad via dedicated buttons above the keyboard. I just tried to create a new project with just a single UITextView and the button correctly appear also on iOS 16 (the name of the button on iOS 16 changed from BIU to "Format"). So, it seems to work with new projects, but in my case, for some reason, all text views in my project are no more showing the "Format" button when the app is executed on iOS 16 (works ok on iOS 15). I also tried to add in my project an empty controller with a UITextView with all attributes set to defaults values (only allowsEditingTextAttributes to true) and also this text view does not show the "Format" button. On the new project the options I have in the menu are: Cut Copy Paste Replace... Format Look Up Translate Search Web Share... On my project the options are: Cut Copy Paste Replace... Look Up Translate Search Web Share... I'm trying to figure out what in my project is causing all text views to lose the Format button on iOS 16. Has anyone else had this problem? Thank you
Topic: UI Frameworks SubTopic: UIKit Tags:
Dec ’22
Reply to UITextView BIU button missing on iOS 16 (text formatting)
I found the cause of the issue. My project is a Catalyst project and I used a UIMenuBuilder inside the AppDelegate buildMenu(with:) method to remove some items from the Mac menu bar. One of the item I removed was the format menu (UIMenu.Identifier.format). This on iOS 15 has no effect to the UITextView menu, but on iOS 16 removing the format menu cause the UITextView menu to also hide the "Format" item. I think it has someting to do with the fact that the item was renamed from "BIU" (iOS 15) to "Format" (iOS 16). So, I added a condition to remove the menu items only when the environment is macCatalyst and now everything works as expected.
Topic: UI Frameworks SubTopic: UIKit Tags:
Nov ’22
Reply to RC sending non-specific file format to simulator no longer opens Files app to import
Same issue here. While waiting for a fix, does anyone know of an alternative way to transfer files to an iOS 26 RC simulator?
Replies
Boosts
Views
Activity
Sep ’25
Reply to No large titles margin on iOS 26
Just found that in order to bring back the large title margin, I have to set the navigation controller navigation bar preservesSuperviewLayoutMargins property to true. navigationBar.preservesSuperviewLayoutMargins = true
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Aug ’25
Reply to Popover from NSToolbarItem in Mac Catalyst app
Unfortunately not. What I ended up doing was displaying the popover at specific fixed coordinates to make it look like the origin is the button item in the toolbar. It's not ideal, but it does the job. Here is the result:
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Jan ’24
Reply to String(localized:) return \' as thousands separator
Never mind. I was printing the string in the console with the "po" command, like so: po String(localized:"\(1000) apples") For some reason when using "po", all ' characters inside strings are displayed with a backslash. For example this: po "1'000" will output this: "1\'000"
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’23
Reply to Swift String Catalog Localisable
How do you call localized strings from your code? Using NSLocalizedString or String(localized:)?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to Mark localized strings untranslatable
Wow, not be able to opt-out strings from interface builder files is really a problem! It often happens to add elements in IB, UILabels for example, whose content is populated via code. We really need a way for specify that a particular IB item should not be localized. What is the recommended approach to handle these cases?
Replies
Boosts
Views
Activity
Aug ’23
Reply to Search bar in navigation bar displayed as icon
Just found that this is due to the iOS 16 preferredSearchBarPlacement feature. In order to always display the search bar we need to set this property to stacked. if #available(iOS 16.0, *) { navigationItem.preferredSearchBarPlacement = .stacked }
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Aug ’23
Reply to PHAsset unique identifier across devices.
Have you tried looking at PHCloudIdentifier? It allows you to identify an asset synced via iCloud. https://developer.apple.com/documentation/photokit/phcloudidentifier
Replies
Boosts
Views
Activity
Aug ’23
Reply to NSDiffableDataSourceSnapshot doesn't call Hashable methods if ItemIdentifierType is class
I just ran into this issue. If I try to use a class instead of a struct as a diffable data source object, the hashable methods are not called causing issues. I haven't found anything documented about this limitation. It would be nice to get an official feedback about this. As a temporary fix, logancautrell solution works perfectly, thank you for sharing that.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Jul ’23
Reply to Does adding a Core Data Transformer require migration to a new model version?
I have the same exact question. Does adding or removing a Transformer class require a new version of the store? day, what did you find out? Thank you
Replies
Boosts
Views
Activity
Apr ’23
Reply to Loop through CoreData objects and memory issue
I found that a way to reclaim memory is to frequently reset the context. Since objects are invalidated after a reset, I decided to work with objects ids instead (these will remain the same after a reset). This is my new code: var objectsIds = managedObjectContext.allImages.map({$0.objectID}) for objectsIdsChunk in objectsIds.chunked(into: 100) { for objectId in objectsIdsChunk { autoreleasepool { if let image = managedObjectContext.object(with: objectId) as? Image { var imageData = image.imageData } } } managedObjectContext.reset() } This is the array chunked extension: extension Array { func chunked(into size: Int) -> [[Element]] { return stride(from: 0, to: count, by: size).map { Array(self[$0 ..< Swift.min($0 + size, count)]) } } } With this solution the memory level remain low.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Apr ’23
Reply to Crash on VectorKit (EXC_BAD_ACCESS KERN_INVALID_ADDRESS)
Some of the users of one of my app have the same exact crash. Also in my case it's a MapKit app. Tommy8, did you figure out what was the problem? This is my crash report: Thread 3 name: com.apple.vectorkit.dispatch.layoutqueue Thread 3 Crashed: 0 VectorKit 0x1ad0f8830 md::FontAtlas::freeCell(md::FontAtlasCell*) + 164 1 VectorKit 0x1ad0f8820 md::FontAtlas::freeCell(md::FontAtlasCell*) + 148 2 VectorKit 0x1ad0f7fb4 md::FontAtlas::flushOldestCell() + 104 3 VectorKit 0x1acd4f064 md::FontAtlas::finishFrame(std::__1::shared_ptr<ggl::RenderTransaction> const&) + 112 4 VectorKit 0x1acd1d89c md::LabelManager::layout(md::LayoutContext const&, md::CartographicRenderer const*, std::__1::unordered_set<std::__1::shared_ptr<md::LabelMapTile>, std::__1::hash<std::__1::shared_ptr<md::LabelMapTile> >, std::__1::equal_to<std::__1::shared_ptr<md::LabelMapTile> >, geo::StdAllocator<std::__1::shared_ptr<md::LabelMapTile>, mdm::Allocator> > const&, md::PassList&) + 2628 5 VectorKit 0x1acce723c md::LabelRenderLayer::layout(md::LayoutContext const&) + 916 6 VectorKit 0x1accec488 std::__1::__function::__func<md::CartographicRenderLayer::frame(md::LayoutContext const&)::$_0, std::__1::allocator<md::CartographicRenderLayer::frame(md::LayoutContext const&)::$_0>, void ()>::operator()() + 112 7 VectorKit 0x1accd6a00 invocation function for block in geo::TaskQueue::queueAsyncTask(std::__1::shared_ptr<geo::Task>, NSObject<OS_dispatch_group>*) + 108 8 libdispatch.dylib 0x19ae9f460 _dispatch_call_block_and_release + 32 9 libdispatch.dylib 0x19aea0f88 _dispatch_client_callout + 20 10 libdispatch.dylib 0x19aea8640 _dispatch_lane_serial_drain + 672 11 libdispatch.dylib 0x19aea91c0 _dispatch_lane_invoke + 436 12 libdispatch.dylib 0x19aeaa4a4 _dispatch_workloop_invoke + 1780 13 libdispatch.dylib 0x19aeb3e10 _dispatch_workloop_worker_thread + 652 14 libsystem_pthread.dylib 0x1e118cdf8 _pthread_wqthread + 288 15 libsystem_pthread.dylib 0x1e118cb98 start_wqthread + 8
Replies
Boosts
Views
Activity
Mar ’23
Reply to Xcode 14.0 Crashes when Opening Storyboard Interface Builder
Updated to Xcode 14.2. Same issue, can't edit my storyboard because Xcode crash. For now I can continue working with Xcode 13 but this problem is really starting to worry me.
Replies
Boosts
Views
Activity
Dec ’22
Reply to UITextView BIU button missing on iOS 16 (text formatting)
Hi Claude31. Did you set allowsEditingTextAttributes to true? When you do that, users are able to change formatting to bold, underline and italics on iPhone via the menu and on iPad via dedicated buttons above the keyboard. I just tried to create a new project with just a single UITextView and the button correctly appear also on iOS 16 (the name of the button on iOS 16 changed from BIU to "Format"). So, it seems to work with new projects, but in my case, for some reason, all text views in my project are no more showing the "Format" button when the app is executed on iOS 16 (works ok on iOS 15). I also tried to add in my project an empty controller with a UITextView with all attributes set to defaults values (only allowsEditingTextAttributes to true) and also this text view does not show the "Format" button. On the new project the options I have in the menu are: Cut Copy Paste Replace... Format Look Up Translate Search Web Share... On my project the options are: Cut Copy Paste Replace... Look Up Translate Search Web Share... I'm trying to figure out what in my project is causing all text views to lose the Format button on iOS 16. Has anyone else had this problem? Thank you
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Dec ’22
Reply to UITextView BIU button missing on iOS 16 (text formatting)
I found the cause of the issue. My project is a Catalyst project and I used a UIMenuBuilder inside the AppDelegate buildMenu(with:) method to remove some items from the Mac menu bar. One of the item I removed was the format menu (UIMenu.Identifier.format). This on iOS 15 has no effect to the UITextView menu, but on iOS 16 removing the format menu cause the UITextView menu to also hide the "Format" item. I think it has someting to do with the fact that the item was renamed from "BIU" (iOS 15) to "Format" (iOS 16). So, I added a condition to remove the menu items only when the environment is macCatalyst and now everything works as expected.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Nov ’22