Post

Replies

Boosts

Views

Activity

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
482
May ’24
How do you configure a document-based SwiftUI multi-platform app to be able to import .log files?
In a new document-based UIKit app, specifying in the Info.plist an import type identifier of public.log that conforms to public.content, public.data, public.item accomplishes this. In a new document-based SwiftUI multi-platform app, doing the same crashed at the DocumentGroup initializer with the error _SwiftData_SwiftUI/Documents.swift:91: Fatal error: The document type is public.log which does not conform to com.apple.package. This initializer expects the document type to be a package.
1
0
514
Mar ’24
How do you apply a diffable data source UI snapshot only after awaiting (with async/await) data fetched from the network?
I'm new to async/await, and am currently migrating my completion handler code to Swift 5.5's concurrency features. After generating an sync alternative in Xcode to my function func fetchMatchRecords(completion: @escaping ([Match]) -> Void), it becomes func fetchMatchRecords() async -> [Match]. I'm not sure how it would be used in the context of UIKit and diffable data sources. In a viewDidLoad, previously it would be MatchHistoryController.shared.fetchMatchRecords() { matches in DispatchQueue.main.async { self.dataSource.apply(self.initialSnapshot(), animatingDifferences: false) } } But I'm not sure how it would be used now Task { await MatchHistoryController.shared.fetchMatchRecords() } self.dataSource.apply(self.initialSnapshot(), animatingDifferences: false) How would I make sure that the snapshot is applied only after awaiting a successful fetch result? Here's the definition of initialSnapshot() that I used: func initialSnapshot() -> NSDiffableDataSourceSnapshot<Section, Match> { var snapshot = NSDiffableDataSourceSnapshot<Section, Match>() snapshot.appendSections([.main]) snapshot.appendItems(MatchHistoryController.shared.matches) return snapshot }
1
0
1.9k
Sep ’21
Invalid `Podfile` file: cannot load such file -- cocoapods-catalyst-support
I encountered this error 2023-01-24T22:14:41.500565325Z Installing ri documentation for cocoapods-catalyst-support-0.2.1 2023-01-24T22:14:41.500827390Z Done installing documentation for colored2, concurrent-ruby, i18n, tzinfo, zeitwerk, activesupport, nap, fuzzy_match, httpclient, algoliasearch, ffi, ethon, typhoeus, netrc, public_suffix, addressable, cocoapods-core, claide, cocoapods-deintegrate, cocoapods-downloader, cocoapods-plugins, cocoapods-search, cocoapods-trunk, cocoapods-try, molinillo, atomos, nanaimo, rexml, xcodeproj, escape, fourflusher, gh_inspector, ruby-macho, cocoapods, cocoapods-catalyst-support after 50 seconds 2023-01-24T22:14:41.500997230Z 35 gems installed 2023-01-24T22:14:42.023353910Z [in /Volumes/workspace/repository] 2023-01-24T22:14:42.023798292Z 2023-01-24T22:14:42.024448317Z [!] Invalid `Podfile` file: cannot load such file -- cocoapods-catalyst-support. 2023-01-24T22:14:42.024714192Z 2023-01-24T22:14:42.024976712Z # from /Volumes/workspace/repository/Podfile:1 2023-01-24T22:14:42.025200239Z # ------------------------------------------- 2023-01-24T22:14:42.025463448Z > require 'cocoapods-catalyst-support' 2023-01-24T22:14:42.025663811Z # 2023-01-24T22:14:42.025900158Z # ------------------------------------------- from my post-clone script, which is #!/bin/sh # ci_post_clone.sh export GEM_HOME="$HOME/.gem" gem install bundler brew install cocoapods gem install cocoapods-catalyst-support # Install dependencies managed with CocoaPods. pod install
2
0
4.2k
Jan ’23
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
540
Jul ’23
Constrain view's top anchor to just at the edge of sensor housing
What might be a good way to constrain a view's top anchor to be just at the edge of a device's Face ID sensor housing if it has one? This view is a product photo that would be clipped too much if it ignored the top safe area inset, but if it was positioned relative to the top safe area margin this wouldn't be ideal either because of the slight gap between the sensor housing and the view (the view is a photo of pants cropped at the waist). What might be a good approach here?
0
0
993
Aug ’21
"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
703
Dec ’22