Posts

Post not yet marked as solved
3 Replies
607 Views
Hi,I'm trying to figure out how an NSViewController can check if it was presented as a popvoer, so it might by notification and delegate pattern inform observers and let delegate act upon disappearing of the popover by overriding viewWillDisappear method.So far I've with this solution:- (BOOL)isPresentedAsPopover { id popoverFrameClass = NSClassFromString(@"NSPopoverFrame"); id ourSuperViewClass = [[[self view] superview] class]; return [ourSuperViewClass isEqualTo:popoverFrameClass]; }I've found that when a NSViewController is presented as popover programmatically via presentViewController:asPopoverRelativeToRect:ofView:preferredEdge:behavior: method its view gets embedded in a NSPopoverFrame class view.Which seems to be part of a class cluster pattern, hence it's a private class. I don't like this kind of solution, knowing that in future this could change etc.Is there a better way to do that, rather than setting boolean property value in the View Controller when presenting it programmatically as a popover?
Posted
by vale_mac.
Last updated
.
Post not yet marked as solved
0 Replies
260 Views
Hi, I'd like to start playing around with the new Swift Concurrency framework in a Swift Package, but I cannot use AsyncSequence. AsyncSequence is not available despite I'm using swift-tools-version:5.5 in my package manifest.
Posted
by vale_mac.
Last updated
.
Post not yet marked as solved
0 Replies
392 Views
Hi,I'm using PDF for the images in my project's Assets, so far so good aside for having found that it looks like that this filetype it won't work with UIApplicationShortcutIcon. Can someone confirm that it only works with individual bitmaps rendered images (@1x-@2x-@3x)?I ended up using the Photoshop template provided at https://developer.apple.com/design/downloads/Quick-Action-Guides.zip to create the bitmap version of my icons. These templates have also size guides, while on the pdf version of my icons I usually let the graphics match the border of the canvas since they are shapes. In regards to those borders I have also two more questions:1) should the icon be a square with rounded borders, is it better to adhere to the round size guide, or is it ok use the width and height guides? (canvas is slightly bigger for the latter case); 2) in the PDF version of the icon, should I respect those size guides too, or is ok to let the gliph hit the border of the canvas even though it's gonna be different from the bitmap version? (That's cause in my project 's assets.xcassets those icon gliphs are provided for the scale as "individual and single scales" rather than making two different assets for each gliph).
Posted
by vale_mac.
Last updated
.
Post not yet marked as solved
10 Replies
2.2k Views
Hi,I'm using NSPersistentContainer inside my iOS App Today Widget Extension. So far so good everything seems to work fine excpet for the deallocation.It looks like that since the deallocation of the NSPersistentContainer does also some background activity, and since the Today Widget Extension does not get the possibility to do those background tasks using the UIApplication API, I get this error in the console:Can't endBackgroundTask: no background task exists with identifier 6, or it may have already been ended. Break in UIApplicationEndBackgroundTaskError() to debug.I've already set the Breakpoint and traced that the error indeed happens while the extension deallocates the NSPersistentContainer instance. If I set to nil the NSPersistentContainer instance in the viewDidDisappear method of the extension's view controller, the error doesn't get triggerd. I am assuming that's because having the deallocation of the NSPersistentContainer instance happening in the viewDidDisappear method gives the deallocation process more time to get done and those background tasks get done and invalidated fine.Should I use a different approach for deallocatiing that resource, perhaps using the NSProcessInfo API, or is it ok to do that deallocation in viewDidDisappear, having given that the Extesnion has only one (the main) viewController and that once that viewController diappears the system will most likely than not also deallocate it cause it'll kill the extension?
Posted
by vale_mac.
Last updated
.