Discuss the different user interface frameworks available for your app.

All subtopics
Posts under UI Frameworks topic

Post

Replies

Boosts

Views

Activity

Custom attribute for CSSearchableItemAttributeSet seems not working
In the document it says you can define your own custom attribute: The attributes you choose depend on your domain. You can use the properties that Core Spotlight provides in categories that CSSearchableItemAttributeSet defines (such as Media and Documents), or you can define your own. If you want to define a custom attribute, be as specific as possible in your definition and use the contentTypeTree property so that your custom attribute can inherit from a known type. I tried to index a custom attribute with the following code: class mySpotlightDelegate:NSCoreDataCoreSpotlightDelegate { static let myCustomAttr = CSCustomAttributeKey(keyName: "myCustomAttr")! override func attributeSet(for object: NSManagedObject) -> CSSearchableItemAttributeSet? { if let myObject = object as? MyObject { let attributeSet = CSSearchableItemAttributeSet(contentType: .bookmark) attributeSet.title = myObject.name attributeSet.setValue( NSString(string: myObject.myAttr), forCustomKey: mySpotlightDelegate.myCustomAttr ) return attributeSet } return nil } } But later I couldn't either search with the custom attribute nor get the value of that custom attribute in the CSSearchQuery foundItemsHandler. (The search returns nil and when searched with title it was fine, but when I tried to get the value of custom attribute of returned items with item.attributeSet.value(forCustomKey: mySpotlightDelegate.myCustomAttr), the value is always nil) I've read through all official document regarding this and also searched everywhere but can't find an example of this anywhere, execept 2 other developers complaining about this problem. Is this a bug, or I'm doing it wrong? What's the right way to do it?
0
0
863
Feb ’22
Xcode module's paths bug
Hello everyone, I faced with a problem: when I try to use Firebase and FirebaseFirestoreSwift (installed via Xcode Package Manager, latest version) for Codable, - I got error for this part of code: documents.compactMap({ QueryDocumentSnapshot -> User? in   return try? QueryDocumentSnapshot.data(as: User.self) }) Value of type 'NSObject' has no member 'data' By the way, I used official docs to import Firebase and FirebaseFirestoreSwift import Foundation import Firebase import FirebaseFirestoreSwift I tried to build my code via another IDEA (AppCode) - and it built it perfectly without any error. When I tried to clear build cache I was getting next error: No such module 'FirebaseFirestoreSwift' But it is installed! Please, help me to fix this issue Maybe I am doing something wrong Thank you all in advance
1
0
799
Jan ’22
Trouble with WWDC21 sample code for CloudKit
Hey all, I've just taken Xcode 13 Beta 2, and I still can't get the sample code from the "Sharing-Data" code to work properly, and nor does the boilerplate code from creating a new project that incorporates CodeData and CloudKit work. Fo far my feedback items have not been identified as having other similar issues - based on the posts I'm seeing I'm not the only one experiencing the same problem. Has anyone got this code built and working yet? Mine breaks when you try to copy the sharing link.
4
0
1.6k
Jan ’22
Keyboard shortcuts for standard iPadOS 15 keyboard shortcuts
My iPad app supports features such Copy (cmd-C) and Paste (cmd-V). How can I get these to show in the Edit menu when I hold down the Command key? Undo (cmd-Z) and Redo (shift-cmd-Z) show perfectly. Looks like the system internally looks at UndoManager. Same with Hide Sidebar: system detected presence of Sidebar and is showing the keyboard shortcut to hide it. Ramon.
1
0
1.2k
Jan ’22
iOS 15 simulator vs. Cloudkit sharing invites
I am running the WWDC21 sample application "CoreDataCloudkitDemo" with two different Apple IDs to test the Cloudkit sharing feature. I use two simulators and one real device, where the latter has the same ID as one of the simulators. While creating invites via "Copy link" works on all three installations, accepting invites only works on the real device. Trying to open an invite (by copying the link in the one and pasting it into Safari in the other) always results in a web page stating that "iCloud has stopped responding" and "Unable to find applicationIdentifier for the containerId = [my ID] and fileExtension = undefined". Is this a simulator bug in Xcode 13.2 or is there anything I can do about it? Other iCloud features (including login via Safari to icloud.com) work in both simulators. Is there a way to open invite URLs in a simulator (as there is no functioning iMessage or Mail app) other than Safari's URL input field? Doing so does not work in the real device either, but clicking it in e.g. iMessage works. Edit: Pasting the link into a ToDo item and opening it from there works even in the simulator - so is it just a Safari issue?
0
0
1.3k
Jan ’22
handle never invoked with WKURLSessionRefreshBackgroundTask type
Hi Folks, I am building a SwiftUI based WatchOS app primarily focused on updating a complication using data from a REST API call. I am trying to reproduce the approach to updating complications in the background as described in "Keeping your complications up to date". The trouble I have is that the func handle(_ backgroundTasks: Set<WKRefreshBackgroundTask>) method on the ExtensionDelegate is never called for the WKURLSessionRefreshBackgroundTask task type. The handle method is invoked for other task types such as WKSnapshotRefreshBackgroundTask. After some refactoring, I have deviated from the approach in the video and I now reshedule the background task in the func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) method of the URLSessionDownloadDelegate. This works fine, and the tasks are being resheduled in the background, but my concern is that there maybe a WKURLSessionRefreshBackgroundTask object lurking in the background for which I haven't called setTaskCompletedWithSnapshot. My session is configured as follows: private lazy var backgroundURLSession: URLSession = { let appBundleName = Bundle.main.bundleURL.lastPathComponent.lowercased().replacingOccurrences(of: " ", with: ".") let sessionIdentifier = "com.gjam.liffeywatch.\(appBundleName)" let config = URLSessionConfiguration .background(withIdentifier: sessionIdentifier) config.isDiscretionary = false config.sessionSendsLaunchEvents = true config.requestCachePolicy = .reloadIgnoringLocalCacheData config.urlCache = nil return URLSession (configuration: config, delegate: self , delegateQueue: nil ) }() and the scheduling code is a follows: func schedule(_ first: Bool) { print("Scheduling background URL session") let bgTask = backgroundURLSession.downloadTask(with: LiffyDataProvider.url) #if DEBUG bgTask.earliestBeginDate = Date().addingTimeInterval(first ? 10 : 60 * 2) #else bgTask.earliestBeginDate = Date().addingTimeInterval(first ? 30 : 60 * 60 * 2) #endif bgTask.countOfBytesClientExpectsToSend = 200 bgTask.countOfBytesClientExpectsToReceive = 1024 bgTask.resume() print("Task started") backgroundTask = bgTask } Does anyone have any idea's why the handle method is not invoked with WKURLSessionRefreshBackgroundTask tasks? Cheers, Gareth.
2
0
1.2k
Jan ’22
@MainActor and the guarantee that the properties are only ever accessed from the main actor
In https://developer.apple.com/videos/play/wwdc2021-10019/?time=815 was said: "By adding the new @MainActor annotation to Photos, the compiler will guarantee that the properties (...) are only ever accessed from the main actor." What does it exactly mean? Let's consider the following example: @MainActor class ViewModel: ObservableObject {   @Published var text = "" } struct ContentView: View {   @StateObject private var viewModel = ViewModel()   var body: some View {     VStack {       Text(viewModel.text)         .padding()       Button("Refresh") {         Task.detached {           await updateText()         }       }     }   }   func updateText() async {     viewModel.text = "Hello, world"   } } Compiler doesn't complain. After button tap viewModel.text is changed from background actor and there is runtime warning: "Publishing changes from background threads is not allowed; make sure to publish values from the main thread (via operators like receive(on:)) on model updates." So once again: How exactly @MainActor annotation and the compiler will guarantee that the properties are only ever accessed from the main actor?
0
0
1.4k
Jan ’22
Inset grouped table cells not aligned with large title
Hi, It seems that when using the inset grouped style in a UITableView, the cells are not aligned with the navigation bar large title. However, I've noticed that all Apple apps that seem to use this style (Settings, Notes) don't have this issue and the cells are perfectly aligned with the title. In the below example you can see that the cells of an inset grouped table are not aligned with the title (extra space between the red line and the cells) but the one's of the Apple apps are perfectly aligned. Do you know if there is a way to change the left and right cells margins of an inset grouped table in order to align them with the large title? Thank you
4
0
4k
Jan ’22
Diffable data source behaviour with different iOS versions/devices
I need to support diffable data source for iOS 13+ devices. But I have different unexpected behaviour with the same codebase. Code runs well on iPhone with iOS 15.1 and crashes with iPad iOS 13.1. I am aware that this API evolves and it has different behaviour with different iOS versions. But these changes are not well exposed usually. Here is the demo project, where the crash happens: https://github.com/Jeka53/diffableCollectionView Would appreciate any help regarding how API works behind the scenes. (Looks like data source doesn't like to be empty on iOS 13.1 iPad). I assume the solution will use compiler iOS version checks with different code flows for different iOS versions. The end goal in the real app is simple. Empty the collection view's snapshot before starting network calls. After data from the network was received, build the snapshot from the ground up.
2
0
1.1k
Dec ’21
MKMapView crash in [[MKMapView alloc] init]
I initialize the mapView following the line: MKMapView *mapView = [[MKMapView alloc] init]; and never crash when debugging, but it has occured some times for my users. Here is the stack frame FATAL_SIGNAL SIGSEGV fault_address:0x0000000000000000 Thread 0 name: com.apple.main-thread 0 VectorKit std::__1::__hash_table<std::__1::__hash_value_type<std::__1::shared_ptr<md::LabelImageKey>,std::__1::__list_iterator<md::LabelImageLoader::CachedItem, void*> >,std::__1::__unordered_map_hasher<std::__1::shared_ptr<md::LabelImageKey>,std::__1::__hash_value_type<std::__1::shared_ptr<md::LabelImageKey>,std::__1::__list_iterator<md::LabelImageLoader::CachedItem, void*> >,md::LabelImageLoader::LabelImageCacheHash, true>, std::__1::__unordered_map_equal<std::__1::shared_ptr<md::LabelImageKey>,std::__1::__hash_value_type<std::__1::shared_ptr<md::LabelImageKey>, std::__1::__list_iterator<md::LabelImageLoader::CachedItem, void*> >, md::LabelImageLoader::LabelImageCacheEq, true>,geo::StdAllocator<std::__1::__hash_value_type<std::__1::shared_ptr<md::LabelImageKey>,std::__1::__list_iterator<md::LabelImageLoader::CachedItem, void*> >,mdm::Allocator> >::__rehash(unsigned long) (in VectorKit) 1 VectorKit md::LabelImageLoader::LabelImageLoader(md::LabelManager&) (in VectorKit) 2 VectorKit md::LabelManager::LabelManager(md::WorldType, VKMapPurpose, VKSharedResources*, std::__1::shared_ptr<md::TaskContext>, ggl::RenderTargetFormat const&, float) (in VectorKit) 3 VectorKit std::__1::__shared_ptr_emplace<md::LabelManager, std::__1::allocator<md::LabelManager>>::__shared_ptr_emplace<md::WorldType, VKMapPurpose&,VKSharedResources*&,std::__1::shared_ptr<md::TaskContext>&, ggl::RenderTargetFormatconst&,float&>(md::WorldType&&, VKMapPurpose&, VKSharedResources*&,std::__1::shared_ptr<md::TaskContext>&, ggl::RenderTargetFormat const&, float&) (in VectorKit) 4 VectorKit md::LabelsLogic::LabelsLogic(float,VKMapPurpose, VKSharedResources*, objc_objectobjcproto14MDRenderTarget*,std::__1::shared_ptr<md::TaskContext>) (in VectorKit) 5 VectorKit md::MapEngine::MapEngine(float, float, float, bool, std::__1::shared_ptr<md::TaskContext> const&,VKMapPurpose,std::__1::unique_ptr<md::AnimationManager, std::__1::default_delete<md::AnimationManager> >,geo::linear_map<md::MapEngineSetting, long long,std::__1::equal_to<md::MapEngineSetting>,std::__1::allocator<std::__1::pair<md::MapEngineSetting, long long> >,std::__1::vector<std::__1::pair<md::MapEngineSetting, long long>,std::__1::allocator<std::__1::pair<md::MapEngineSetting, long long> > > > const&, unsigned long long,GEOApplicationAuditToken*) (in VectorKit) 6 VectorKit md::MapEngine::interactiveMapEngine(float, bool, geo::linear_map<md::MapEngineSetting, long long,std::__1::equal_to<md::MapEngineSetting>,std::__1::allocator<std::__1::pair<md::MapEngineSetting, long long> >,std::__1::vector<std::__1::pair<md::MapEngineSetting, long long>,std::__1::allocator<std::__1::pair<md::MapEngineSetting, long long> > > > const&, unsigned long long,GEOApplicationAuditToken*) (in VectorKit) 7 VectorKit -[VKMapView initShouldRasterize:inBackground:contentScale:auditToken:] (in VectorKit) 8 MapKit -[MKBasicMapView initWithFrame:andGlobe:shouldRasterize:] (in MapKit) 9 MapKit -[MKMapView _commonInitFromIB:gestureRecognizerHostView:locationManager:showsAttribution:showsAppleLogo:] (in MapKit) 10 MapKit -[MKMapView initWithFrame:] (in MapKit) Thanks for answer.
0
0
1.1k
Dec ’21
I use addSubLayer in UIView and nothing happened
Hello! I am creating UIView (subview of main view) and I want to add gradient for background, but I don't use CGRect for create UIView only autolayout therefore my UIView has coordinates 0, 0, width 0 and hight 0. So when I try to use addSubLayer nothing happen. What should I do? //gradient var gradient: CAGradientLayer = {         let gradient = CAGradientLayer()         gradient.colors = [             UIColor(red: 25/255, green: 25/255, blue: 186/255, alpha: 1).cgColor,             UIColor(red: 177/255, green: 146/255, blue: 125/255, alpha: 1).cgColor         ]         gradient.startPoint = CGPoint(x: 0, y: 0.5)         gradient.endPoint = CGPoint(x: 1, y: 0.5)         return gradient }() //UIView var win: UIView = {     let view = UIView()     view.translatesAutoresizingMaskIntoConstraints = false     view.layer.addSublayer(gradient)     gradient.frame = view.bounds     return view }() //layout func winConstraint(_ collections: UICollectionView, _ view: UIView, _ btn: UIView) {     btn.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 25).isActive = true     btn.rightAnchor.constraint(equalTo: view.rightAnchor, constant: -25).isActive = true     btn.topAnchor.constraint(equalTo: collections.bottomAnchor, constant: 8).isActive = true     btn.heightAnchor.constraint(equalToConstant: 100).isActive = true } //from ViewController view.addSubview(win)
4
0
4k
Dec ’21
Share RecordZones or ParentRecords in CoreData-CloudKit Share
Hello everyone, in the App I'm building I'd like to share an entire list of items (records) by just sharing the list itself (parent record or RecordZone). Meanwhile, I'd like to continue using the NSPersistentCloudKitContainer and therefore CoreData sync. Is it possible, with the new features Apple introduced (Sharing RecordZone and Sharing in Cloud & Local Storage), to do what I described, and combine both functions. Thank you, Carlos Steiner
0
0
793
Dec ’21
How to enable native fullscreen on macOS ?
Hi, I play a French game called Dofus and I trie to optimize it for macOS. The game was not retina compatible and can't switch to dark mode. I fixed it by adding NSHighResolutionCapable key to true and NSRequiresAquaSystemAppearance to false in the info.plist file. But as you see, the window isn't compatible with fullscreen mode. We have the + green button instead of the fullscreen button. I haven't access to source code, is there a key or another way to force it to adopt fullscreen mode ? Thanks a lot
0
0
581
Dec ’21
Table() structure selection takes Object.ID but how to obtain reference to NSManagedObject from this ID
I am using the new SwiftUI Table() structure available for macOS. This structure takes a selection of multiple rows as a Set<Object.ID> and can be stored in a state property wrapper like so... @State private var selectedPeople = Set<Person.ID>() (per the example in the Apple documentation) Table() doesn't take any other type of identifier (that I am aware of), so I am constrained to use the ObjectIdentifier unique identifier. I am using Table() to present a list of NSManagedObjects. These NSManagedObjects are sourced from a Core Data Entity relationship property, in this case via a @FetchRequest. I want to be able to add new instances of the entity and also delete existing instances of the entity. I have worked out how to add a new instance - this is relatively easy. What I am struggling to work out is how to delete an NSManagedObject from the Table() by using the Object.ID that is used to track row selection. I have attempted this...     @State private var tableSelection = Set<Action.ID>() ... for actionID in tableSelection { let context = event.managedObjectContext let actionToDelete = context?.object(with: actionID) print(actionToDelete) context?.delete(actionToDelete) } but of course I have a type mismatch here and the compiler complains... Cannot convert value of type 'Action.ID' (aka 'ObjectIdentifier') to expected argument type 'NSManagedObjectID' So how I do grab a reference to the selected NSManagedObject from the set of Action.ID?
1
0
1.7k
Dec ’21
Custom attribute for CSSearchableItemAttributeSet seems not working
In the document it says you can define your own custom attribute: The attributes you choose depend on your domain. You can use the properties that Core Spotlight provides in categories that CSSearchableItemAttributeSet defines (such as Media and Documents), or you can define your own. If you want to define a custom attribute, be as specific as possible in your definition and use the contentTypeTree property so that your custom attribute can inherit from a known type. I tried to index a custom attribute with the following code: class mySpotlightDelegate:NSCoreDataCoreSpotlightDelegate { static let myCustomAttr = CSCustomAttributeKey(keyName: "myCustomAttr")! override func attributeSet(for object: NSManagedObject) -> CSSearchableItemAttributeSet? { if let myObject = object as? MyObject { let attributeSet = CSSearchableItemAttributeSet(contentType: .bookmark) attributeSet.title = myObject.name attributeSet.setValue( NSString(string: myObject.myAttr), forCustomKey: mySpotlightDelegate.myCustomAttr ) return attributeSet } return nil } } But later I couldn't either search with the custom attribute nor get the value of that custom attribute in the CSSearchQuery foundItemsHandler. (The search returns nil and when searched with title it was fine, but when I tried to get the value of custom attribute of returned items with item.attributeSet.value(forCustomKey: mySpotlightDelegate.myCustomAttr), the value is always nil) I've read through all official document regarding this and also searched everywhere but can't find an example of this anywhere, execept 2 other developers complaining about this problem. Is this a bug, or I'm doing it wrong? What's the right way to do it?
Replies
0
Boosts
0
Views
863
Activity
Feb ’22
How to use keyboardLayoutGuide with UIScrollView?
I see from the docs and session how to anchor a view to the keyboard using the new keyboardLayoutGuide on UIView, but how do use keyboardLayoutGuide to replace the old way of handling keyboard notifications and adjusting the contentInset of the scroll view?
Replies
0
Boosts
0
Views
1k
Activity
Feb ’22
Xcode module's paths bug
Hello everyone, I faced with a problem: when I try to use Firebase and FirebaseFirestoreSwift (installed via Xcode Package Manager, latest version) for Codable, - I got error for this part of code: documents.compactMap({ QueryDocumentSnapshot -> User? in   return try? QueryDocumentSnapshot.data(as: User.self) }) Value of type 'NSObject' has no member 'data' By the way, I used official docs to import Firebase and FirebaseFirestoreSwift import Foundation import Firebase import FirebaseFirestoreSwift I tried to build my code via another IDEA (AppCode) - and it built it perfectly without any error. When I tried to clear build cache I was getting next error: No such module 'FirebaseFirestoreSwift' But it is installed! Please, help me to fix this issue Maybe I am doing something wrong Thank you all in advance
Replies
1
Boosts
0
Views
799
Activity
Jan ’22
Trouble with WWDC21 sample code for CloudKit
Hey all, I've just taken Xcode 13 Beta 2, and I still can't get the sample code from the "Sharing-Data" code to work properly, and nor does the boilerplate code from creating a new project that incorporates CodeData and CloudKit work. Fo far my feedback items have not been identified as having other similar issues - based on the posts I'm seeing I'm not the only one experiencing the same problem. Has anyone got this code built and working yet? Mine breaks when you try to copy the sharing link.
Replies
4
Boosts
0
Views
1.6k
Activity
Jan ’22
Keyboard shortcuts for standard iPadOS 15 keyboard shortcuts
My iPad app supports features such Copy (cmd-C) and Paste (cmd-V). How can I get these to show in the Edit menu when I hold down the Command key? Undo (cmd-Z) and Redo (shift-cmd-Z) show perfectly. Looks like the system internally looks at UndoManager. Same with Hide Sidebar: system detected presence of Sidebar and is showing the keyboard shortcut to hide it. Ramon.
Replies
1
Boosts
0
Views
1.2k
Activity
Jan ’22
iOS 15 simulator vs. Cloudkit sharing invites
I am running the WWDC21 sample application "CoreDataCloudkitDemo" with two different Apple IDs to test the Cloudkit sharing feature. I use two simulators and one real device, where the latter has the same ID as one of the simulators. While creating invites via "Copy link" works on all three installations, accepting invites only works on the real device. Trying to open an invite (by copying the link in the one and pasting it into Safari in the other) always results in a web page stating that "iCloud has stopped responding" and "Unable to find applicationIdentifier for the containerId = [my ID] and fileExtension = undefined". Is this a simulator bug in Xcode 13.2 or is there anything I can do about it? Other iCloud features (including login via Safari to icloud.com) work in both simulators. Is there a way to open invite URLs in a simulator (as there is no functioning iMessage or Mail app) other than Safari's URL input field? Doing so does not work in the real device either, but clicking it in e.g. iMessage works. Edit: Pasting the link into a ToDo item and opening it from there works even in the simulator - so is it just a Safari issue?
Replies
0
Boosts
0
Views
1.3k
Activity
Jan ’22
handle never invoked with WKURLSessionRefreshBackgroundTask type
Hi Folks, I am building a SwiftUI based WatchOS app primarily focused on updating a complication using data from a REST API call. I am trying to reproduce the approach to updating complications in the background as described in "Keeping your complications up to date". The trouble I have is that the func handle(_ backgroundTasks: Set<WKRefreshBackgroundTask>) method on the ExtensionDelegate is never called for the WKURLSessionRefreshBackgroundTask task type. The handle method is invoked for other task types such as WKSnapshotRefreshBackgroundTask. After some refactoring, I have deviated from the approach in the video and I now reshedule the background task in the func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) method of the URLSessionDownloadDelegate. This works fine, and the tasks are being resheduled in the background, but my concern is that there maybe a WKURLSessionRefreshBackgroundTask object lurking in the background for which I haven't called setTaskCompletedWithSnapshot. My session is configured as follows: private lazy var backgroundURLSession: URLSession = { let appBundleName = Bundle.main.bundleURL.lastPathComponent.lowercased().replacingOccurrences(of: " ", with: ".") let sessionIdentifier = "com.gjam.liffeywatch.\(appBundleName)" let config = URLSessionConfiguration .background(withIdentifier: sessionIdentifier) config.isDiscretionary = false config.sessionSendsLaunchEvents = true config.requestCachePolicy = .reloadIgnoringLocalCacheData config.urlCache = nil return URLSession (configuration: config, delegate: self , delegateQueue: nil ) }() and the scheduling code is a follows: func schedule(_ first: Bool) { print("Scheduling background URL session") let bgTask = backgroundURLSession.downloadTask(with: LiffyDataProvider.url) #if DEBUG bgTask.earliestBeginDate = Date().addingTimeInterval(first ? 10 : 60 * 2) #else bgTask.earliestBeginDate = Date().addingTimeInterval(first ? 30 : 60 * 60 * 2) #endif bgTask.countOfBytesClientExpectsToSend = 200 bgTask.countOfBytesClientExpectsToReceive = 1024 bgTask.resume() print("Task started") backgroundTask = bgTask } Does anyone have any idea's why the handle method is not invoked with WKURLSessionRefreshBackgroundTask tasks? Cheers, Gareth.
Replies
2
Boosts
0
Views
1.2k
Activity
Jan ’22
@MainActor and the guarantee that the properties are only ever accessed from the main actor
In https://developer.apple.com/videos/play/wwdc2021-10019/?time=815 was said: "By adding the new @MainActor annotation to Photos, the compiler will guarantee that the properties (...) are only ever accessed from the main actor." What does it exactly mean? Let's consider the following example: @MainActor class ViewModel: ObservableObject {   @Published var text = "" } struct ContentView: View {   @StateObject private var viewModel = ViewModel()   var body: some View {     VStack {       Text(viewModel.text)         .padding()       Button("Refresh") {         Task.detached {           await updateText()         }       }     }   }   func updateText() async {     viewModel.text = "Hello, world"   } } Compiler doesn't complain. After button tap viewModel.text is changed from background actor and there is runtime warning: "Publishing changes from background threads is not allowed; make sure to publish values from the main thread (via operators like receive(on:)) on model updates." So once again: How exactly @MainActor annotation and the compiler will guarantee that the properties are only ever accessed from the main actor?
Replies
0
Boosts
0
Views
1.4k
Activity
Jan ’22
corner radius
Apple’s software use corner many places. I want to know there’s precise value of radius. If you know it or sources of it, please tell me.
Replies
0
Boosts
0
Views
701
Activity
Jan ’22
Inset grouped table cells not aligned with large title
Hi, It seems that when using the inset grouped style in a UITableView, the cells are not aligned with the navigation bar large title. However, I've noticed that all Apple apps that seem to use this style (Settings, Notes) don't have this issue and the cells are perfectly aligned with the title. In the below example you can see that the cells of an inset grouped table are not aligned with the title (extra space between the red line and the cells) but the one's of the Apple apps are perfectly aligned. Do you know if there is a way to change the left and right cells margins of an inset grouped table in order to align them with the large title? Thank you
Replies
4
Boosts
0
Views
4k
Activity
Jan ’22
Apple Watch to App info
Hello, I am wondering whether a 3rd party application (which i wish to develop) can request information, such as heart rate, from the apple watch. I wish for my app to have heart rate, as an input. Is this possible? kind regards
Replies
1
Boosts
0
Views
822
Activity
Jan ’22
Is there a way to layout UIKit UIButton title & subtitle horizontally?
I'd like to have the title and subtitle of a UIKit UIButton both on the horizontal axis. I didn't see a configuration option for such. Is there a way to do so? Thanks
Replies
2
Boosts
0
Views
977
Activity
Jan ’22
UIMenuController shown in wrong position after Screen Rotation On iPad
I have a tableView that need to pop up UIMenuController. The menu is shown on correct position by called showMenuFromView:rect:, but after the device been rotated upside down, the same code won't working correct just as the snapshot, how to resolve this problem?
Replies
1
Boosts
0
Views
977
Activity
Dec ’21
Diffable data source behaviour with different iOS versions/devices
I need to support diffable data source for iOS 13+ devices. But I have different unexpected behaviour with the same codebase. Code runs well on iPhone with iOS 15.1 and crashes with iPad iOS 13.1. I am aware that this API evolves and it has different behaviour with different iOS versions. But these changes are not well exposed usually. Here is the demo project, where the crash happens: https://github.com/Jeka53/diffableCollectionView Would appreciate any help regarding how API works behind the scenes. (Looks like data source doesn't like to be empty on iOS 13.1 iPad). I assume the solution will use compiler iOS version checks with different code flows for different iOS versions. The end goal in the real app is simple. Empty the collection view's snapshot before starting network calls. After data from the network was received, build the snapshot from the ground up.
Replies
2
Boosts
0
Views
1.1k
Activity
Dec ’21
MKMapView crash in [[MKMapView alloc] init]
I initialize the mapView following the line: MKMapView *mapView = [[MKMapView alloc] init]; and never crash when debugging, but it has occured some times for my users. Here is the stack frame FATAL_SIGNAL SIGSEGV fault_address:0x0000000000000000 Thread 0 name: com.apple.main-thread 0 VectorKit std::__1::__hash_table<std::__1::__hash_value_type<std::__1::shared_ptr<md::LabelImageKey>,std::__1::__list_iterator<md::LabelImageLoader::CachedItem, void*> >,std::__1::__unordered_map_hasher<std::__1::shared_ptr<md::LabelImageKey>,std::__1::__hash_value_type<std::__1::shared_ptr<md::LabelImageKey>,std::__1::__list_iterator<md::LabelImageLoader::CachedItem, void*> >,md::LabelImageLoader::LabelImageCacheHash, true>, std::__1::__unordered_map_equal<std::__1::shared_ptr<md::LabelImageKey>,std::__1::__hash_value_type<std::__1::shared_ptr<md::LabelImageKey>, std::__1::__list_iterator<md::LabelImageLoader::CachedItem, void*> >, md::LabelImageLoader::LabelImageCacheEq, true>,geo::StdAllocator<std::__1::__hash_value_type<std::__1::shared_ptr<md::LabelImageKey>,std::__1::__list_iterator<md::LabelImageLoader::CachedItem, void*> >,mdm::Allocator> >::__rehash(unsigned long) (in VectorKit) 1 VectorKit md::LabelImageLoader::LabelImageLoader(md::LabelManager&) (in VectorKit) 2 VectorKit md::LabelManager::LabelManager(md::WorldType, VKMapPurpose, VKSharedResources*, std::__1::shared_ptr<md::TaskContext>, ggl::RenderTargetFormat const&, float) (in VectorKit) 3 VectorKit std::__1::__shared_ptr_emplace<md::LabelManager, std::__1::allocator<md::LabelManager>>::__shared_ptr_emplace<md::WorldType, VKMapPurpose&,VKSharedResources*&,std::__1::shared_ptr<md::TaskContext>&, ggl::RenderTargetFormatconst&,float&>(md::WorldType&&, VKMapPurpose&, VKSharedResources*&,std::__1::shared_ptr<md::TaskContext>&, ggl::RenderTargetFormat const&, float&) (in VectorKit) 4 VectorKit md::LabelsLogic::LabelsLogic(float,VKMapPurpose, VKSharedResources*, objc_objectobjcproto14MDRenderTarget*,std::__1::shared_ptr<md::TaskContext>) (in VectorKit) 5 VectorKit md::MapEngine::MapEngine(float, float, float, bool, std::__1::shared_ptr<md::TaskContext> const&,VKMapPurpose,std::__1::unique_ptr<md::AnimationManager, std::__1::default_delete<md::AnimationManager> >,geo::linear_map<md::MapEngineSetting, long long,std::__1::equal_to<md::MapEngineSetting>,std::__1::allocator<std::__1::pair<md::MapEngineSetting, long long> >,std::__1::vector<std::__1::pair<md::MapEngineSetting, long long>,std::__1::allocator<std::__1::pair<md::MapEngineSetting, long long> > > > const&, unsigned long long,GEOApplicationAuditToken*) (in VectorKit) 6 VectorKit md::MapEngine::interactiveMapEngine(float, bool, geo::linear_map<md::MapEngineSetting, long long,std::__1::equal_to<md::MapEngineSetting>,std::__1::allocator<std::__1::pair<md::MapEngineSetting, long long> >,std::__1::vector<std::__1::pair<md::MapEngineSetting, long long>,std::__1::allocator<std::__1::pair<md::MapEngineSetting, long long> > > > const&, unsigned long long,GEOApplicationAuditToken*) (in VectorKit) 7 VectorKit -[VKMapView initShouldRasterize:inBackground:contentScale:auditToken:] (in VectorKit) 8 MapKit -[MKBasicMapView initWithFrame:andGlobe:shouldRasterize:] (in MapKit) 9 MapKit -[MKMapView _commonInitFromIB:gestureRecognizerHostView:locationManager:showsAttribution:showsAppleLogo:] (in MapKit) 10 MapKit -[MKMapView initWithFrame:] (in MapKit) Thanks for answer.
Replies
0
Boosts
0
Views
1.1k
Activity
Dec ’21
I use addSubLayer in UIView and nothing happened
Hello! I am creating UIView (subview of main view) and I want to add gradient for background, but I don't use CGRect for create UIView only autolayout therefore my UIView has coordinates 0, 0, width 0 and hight 0. So when I try to use addSubLayer nothing happen. What should I do? //gradient var gradient: CAGradientLayer = {         let gradient = CAGradientLayer()         gradient.colors = [             UIColor(red: 25/255, green: 25/255, blue: 186/255, alpha: 1).cgColor,             UIColor(red: 177/255, green: 146/255, blue: 125/255, alpha: 1).cgColor         ]         gradient.startPoint = CGPoint(x: 0, y: 0.5)         gradient.endPoint = CGPoint(x: 1, y: 0.5)         return gradient }() //UIView var win: UIView = {     let view = UIView()     view.translatesAutoresizingMaskIntoConstraints = false     view.layer.addSublayer(gradient)     gradient.frame = view.bounds     return view }() //layout func winConstraint(_ collections: UICollectionView, _ view: UIView, _ btn: UIView) {     btn.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 25).isActive = true     btn.rightAnchor.constraint(equalTo: view.rightAnchor, constant: -25).isActive = true     btn.topAnchor.constraint(equalTo: collections.bottomAnchor, constant: 8).isActive = true     btn.heightAnchor.constraint(equalToConstant: 100).isActive = true } //from ViewController view.addSubview(win)
Replies
4
Boosts
0
Views
4k
Activity
Dec ’21
Share RecordZones or ParentRecords in CoreData-CloudKit Share
Hello everyone, in the App I'm building I'd like to share an entire list of items (records) by just sharing the list itself (parent record or RecordZone). Meanwhile, I'd like to continue using the NSPersistentCloudKitContainer and therefore CoreData sync. Is it possible, with the new features Apple introduced (Sharing RecordZone and Sharing in Cloud & Local Storage), to do what I described, and combine both functions. Thank you, Carlos Steiner
Replies
0
Boosts
0
Views
793
Activity
Dec ’21
How to enable native fullscreen on macOS ?
Hi, I play a French game called Dofus and I trie to optimize it for macOS. The game was not retina compatible and can't switch to dark mode. I fixed it by adding NSHighResolutionCapable key to true and NSRequiresAquaSystemAppearance to false in the info.plist file. But as you see, the window isn't compatible with fullscreen mode. We have the + green button instead of the fullscreen button. I haven't access to source code, is there a key or another way to force it to adopt fullscreen mode ? Thanks a lot
Replies
0
Boosts
0
Views
581
Activity
Dec ’21
Table() structure selection takes Object.ID but how to obtain reference to NSManagedObject from this ID
I am using the new SwiftUI Table() structure available for macOS. This structure takes a selection of multiple rows as a Set<Object.ID> and can be stored in a state property wrapper like so... @State private var selectedPeople = Set<Person.ID>() (per the example in the Apple documentation) Table() doesn't take any other type of identifier (that I am aware of), so I am constrained to use the ObjectIdentifier unique identifier. I am using Table() to present a list of NSManagedObjects. These NSManagedObjects are sourced from a Core Data Entity relationship property, in this case via a @FetchRequest. I want to be able to add new instances of the entity and also delete existing instances of the entity. I have worked out how to add a new instance - this is relatively easy. What I am struggling to work out is how to delete an NSManagedObject from the Table() by using the Object.ID that is used to track row selection. I have attempted this...     @State private var tableSelection = Set<Action.ID>() ... for actionID in tableSelection { let context = event.managedObjectContext let actionToDelete = context?.object(with: actionID) print(actionToDelete) context?.delete(actionToDelete) } but of course I have a type mismatch here and the compiler complains... Cannot convert value of type 'Action.ID' (aka 'ObjectIdentifier') to expected argument type 'NSManagedObjectID' So how I do grab a reference to the selected NSManagedObject from the set of Action.ID?
Replies
1
Boosts
0
Views
1.7k
Activity
Dec ’21
Text with line numbers in TextKit 2
What is the recommended approach to rendering text with line numbers in TextKit 2?
Replies
3
Boosts
0
Views
3.1k
Activity
Dec ’21