Post

Replies

Boosts

Views

Activity

Progress estimate for a `VNVideoProcessor` operation
Would might be a good approach to estimating a VNVideoProcessor operation? I'd like to show a progress bar that's useful enough like one based the progress Apple vends for the photo picker or exports. This would make a world of difference compared to a UIActivityIndicatorView, but I'm not sure how to approach handrolling this (or if that would even be a good idea). I filed an API enhancement request for this, FB9888210.
0
0
594
Feb ’22
How does the action duration parameter affect performance?
For a Create ML activity classifier, I’m classifying “playing” tennis (the points or rallies) and a second class “not playing” to be the negative class. I’m not sure what to specify for the action duration parameter given how variable a tennis point or rally can be, but I went with 10 seconds since it seems like the average duration for both the “playing” and “not playing” labels. When choosing this parameter however, I’m wondering if it affects performance, both speed of video processing and accuracy. Would the Vision framework return more results with smaller action durations?
0
0
708
Feb ’22
How do you determine which threads run loop to receive events, in the context of Combine publishers?
This Mac Catalyst tutorial (https://developer.apple.com/tutorials/mac-catalyst/adding-items-to-the-sidebar) shows the following code snippet: recipeCollectionsSubscriber = dataStore.$collections .receive(on: RunLoop.main) .sink { [weak self] _ in guard let self = self else { return } let snapshot = self.collectionsSnapshot() self.dataSource.apply(snapshot, to: .collections, animatingDifferences: true) }
0
0
632
May ’22
How do you extend a modern collection view cell's default content configuration?
Apple's Displaying Cell Info tutorial shows using a default cell content configuration to set two lines of text func cellRegistrationHandler(cell: UICollectionViewListCell, indexPath: IndexPath, id: String) { let reminder = Reminder.sampleData[indexPath.item] var contentConfiguration = cell.defaultContentConfiguration() contentConfiguration.text = reminder.title contentConfiguration.secondaryText = reminder.dueDate.dayAndTimeText contentConfiguration.secondaryTextProperties.font = UIFont.preferredFont(forTextStyle: .caption1) cell.contentConfiguration = contentConfiguration } How would I get started extending this to include a third line of text? I would like to keep the built-in text, secondaryText, and accessory control (the tutorial has a done button on each cell), while also adding custom UI elements. I'm assuming this is possible since Apple uses the term "compositional collection views," but I'm not sure how to accomplish this. Is it possible, or would I instead need to register a custom UICollectionViewCell subclass?
Topic: UI Frameworks SubTopic: UIKit Tags:
0
0
733
May ’22
"Portrait-only" app presenting a landscape-only modal. What is the recommended way to do this and have a seamless modal dismissal?
override var supportedInterfaceOrientations: UIInterfaceOrientationMask { return [.landscapeRight, .landscapeLeft] } My modal view controller overrides this property, as its a complex custom video player that needs to be restricted to landscape. However, when it's dismissed, there is a jarring bug in the transition where the presenting VC is portrait in the device's landscape state for a second while half of the screen is black. It returns to normal (portrait) after a second, but I would like to avoid this transition bug. What might I be missing as to the root cause, or recommended way to have a portrait app (set in project navigator) present a landscape-only view controller?
0
0
785
Dec ’22
How do you start an `SKProductsRequest` in a watchOS app, when the existing product identifiers from the iOS app use a main bundle ID?
I have a watchOS app (not independent) that I'm trying to bring StoreKit support to purchasing subscriptions. When I make my existing StoreKit manager for iOS target watchOS, the productsRequest(_:didReceive:) delegate callback returns an empty response.products array but I don't understand why. One guess as to the cause is that when I initialize the SKProductsRequest, the products identifiers I pass ones with prepended bundle identifiers, which may different between iOS and watchOS? The existing iOS code has the format static let subscriptionKindOne = Bundle.main.bundleIdentifier!.lowercased() + ".subscriptionKindOne" static let subscriptionKindTwo = Bundle.main.bundleIdentifier!.lowercased() + ".subscriptionKindTwo" static let subscriptionKindThree = Bundle.main.bundleIdentifier!.lowercased() + ".subscriptionKindThree" Is this right? If so, what would be the correct way to start a products request on watchOS, so that the SKProductsResponse products array is populated?
0
0
642
Jul ’23
In Mac Catalyst, what would be the simplest way to hide the title bar but retain its double click functionality?
After adopting sidebar / split view controller support in Mac Catalyst, there are several UI side effects that make the default title bar stick out and look inconsistent. If I hide the title bar however, func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { guard let windowScene = (scene as? UIWindowScene) else { return } #if targetEnvironment(macCatalyst) if let titlebar = windowScene.titlebar { titlebar.titleVisibility = .hidden titlebar.toolbar = nil } #endif } the ability to double click the top of the window to maximize it is lost. What would be the simplest approach to have both the hidden appearance, but keep the double click behavior?
0
0
670
May ’24