Post

Replies

Boosts

Views

Activity

Reply to How do I get Applications in categoryTokens
EDIT: My bad, i found this thread while looking on a way to list all categories / construct single category without displaying picker first. Looking at the API it seems this is not possible, but as per my original post, the video suggests that it should be possible. @Kmart are you sure? WWDC's "what's new in screentime api" suggest that it might somehow be possible. https://developer.apple.com/videos/play/wwdc2022/110336/ at 5:25 you can see the following code snipet: import ManagedSettings extension ManagedSettingsStore .Name { static let gaming = Self( "gaming" ) } func worklogSetup() { let gamingCategory = ActivityCategoryToken(...) let gamingStore = ManagedSettingsStore(named: .gaming) gamingStore.shield.webDomainCategories = .specific([gamingCategory]) } Have no idea how that ActivityCategoryToken is constructed, but I don't think the code suggests that the user had to select that category beforehand. Later in the video they create another ManagedSettingsStore the same way.
Oct ’23
Reply to CALayer Subclass redraw understanding issue
This is super old thread, but since I found it while searching for the answer, I will answer it. From the docs about init(layer: Any): This initializer is used by CoreAnimation to create shadow copies of layers, e.g. for use as presentation layers. Subclasses can override this method to copy their instance variables into the presentation layer (subclasses should call the superclass afterwards). Calling this method in any other situation will result in undefined behavior. So basically that method gets called when CoreAnimation decides that it needs a new copy of your layer. Changing background color triggers this. On iOS this method got triggered when I change strokeColor. If you have some custom vars on your subclass, you need to copy the values in this method (the layer argument is your old layer so you need to typecast it and then copy the custom params before calling super).
Oct ’22