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 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.
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)
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.
Nov ’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
Nov ’22