Discuss the different user interface frameworks available for your app.

All subtopics
Posts under UI Frameworks topic

Post

Replies

Boosts

Views

Activity

Help!!! How to eliminate the ">" nav link symbol from list items?
Have spent 2 hours on this without success, and have not found any info on-line. I've put together a list of items (regular swiftui list) and when I add a Navigation Link, it modifies the list item view to add a ">" symbol to the right of the list item. This is the current code from the list view (calls a sub-view - that works perfect, but I don't want the ">" symbol appearing on each item. List ($viewModel.teams) { Team in NavigationLink(destination: GroupMembersView(user: user, team: Team)) { GroupsCellView(team: Team) }.buttonStyle(PlainButtonStyle()) }.listStyle(.plain) Here is a picture of the nav view & undesired symbol (symbol appears on the right hand side of every item in list): How can I remove this symbol? -thanks!
4
0
6.9k
Apr ’22
NSPersistentCloudKitContainer Bug
I have been excited to add NSPersistentCloudKitContainer's share functionality to my app but I've noted a few thing I suspect are bugs: -When using share() on a NSManagedObject the share record is set up in a new zone. However, the root NSManagedObject's record is not being updated with the relationship linkage to the shared record. -Secondly, when you revoke a share, the cloudkit.share record is removed from iCloud, but not in the local data stores. This makes the fetchShares() method ineffective for detecting a missing cloudkit.share record. In order to re-share the root object the developer must call out to iCloud directly using the old methods to be sure if the share exists or not. I am using the code from Apple's 'Synchronizing a Local Store to the Cloud' sample. It would be nice if they added support for revoking shares into this sample and addressed these issues.
8
0
6.1k
Apr ’22
How Text Layout Manager generates Layout Fragment from Text Elements?
During the presentation (19:43) it says the NSTextLayoutFragment 'Layout information for one or more elements'. But from the documentation it seems that you can only generate a layout fragment from one NSTextElement. Besides there is only one property that associates a text element. What does it mean by 'parent element' anyway?
0
0
831
Apr ’22
Deleting a Share without deleting Objects
Hi, I wanted to offer the UI for editing and deleting a share. So for using UICloudSharingController(share: , container: ) I implemented the delegate to call "persistUpdatedShare" in "cloudSharingControllerDidSaveShare" func cloudSharingControllerDidSaveShare(_ csc: UICloudSharingController) { if let share = csc.share,   let privatePersistentStore = PersistenceController.shared.privatePersistentStore { PersistenceController.shared.container.persistUpdatedShare(share, in: privatePersistentStore) { (share, error) in Thread.performOnMain { if let error = error { PersistenceController.shared.storeWarning = error } } } } } and to call "purgeObjectsAndRecordsInZone" in "cloudSharingControllerDidStopSharing" func cloudSharingControllerDidStopSharing(_ csc: UICloudSharingController) { let puzzleToShare = puzzleToShare if let share = csc.share,   let privatePersistentStore = PersistenceController.shared.privatePersistentStore { PersistenceController.shared.container.purgeObjectsAndRecordsInZone(with: share.recordID.zoneID, in: privatePersistentStore) { (zoneID, error) in Thread.performOnMain { if let error = error { PersistenceController.shared.storeWarning = error } else { puzzleToShare.makePrivateDuplicate() try? puzzleToShare.puzzle.managedObjectContext?.save() } } } } } I got this implementation from a TSI, but it makes no sense to me to delete and duplicate my objects rather than just keeping them and only deleting the share. Question: How can I cleanly discontinue a share, but keep my data. Duplicating my objects seems such a weird approach. But without this implementation it does not really work. (I get strange behaviors and crashes) All the best Christoph
1
0
1.3k
Mar ’22
Is it possible to set Focus on .searchable in SwiftUI
I am trying to set the focus on the .searchable text entry field using @FocuseState and .focused($focusedField, equals: .search) technique demonstrated by Tanu in her WWDC21-10023 talk, but I'm not sure if it is a focusable element or how to programmatically set it. My attempt: //based on a technique presented in https://developer.apple.com/videos/play/wwdc2021/1002 and Paul Hudson's article https://www.hackingwithswift.com/quick-start/swiftui/how-to-add-a-search-bar-to-filter-your-data import SwiftUI enum Field: Hashable {   case search } struct ContentView: View {   let itemsToSearch = ["John", "Mark", "Adam", "Carol", "Ismael", "Vanessa", "Aniq"]   @FocusState private var focusedField: Field?   @State private var searchText = ""   var body: some View {     NavigationView {       List {         ForEach(searchResults, id: \.self) { itemsToSearch in           NavigationLink(destination: Text(itemsToSearch)) {             Text(itemsToSearch)           }         }       }       .searchable(text: $searchText, placement: .navigationBarDrawer(displayMode: .always)) {         ForEach(searchResults, id: \.self) { result in           Text("\(result)").searchCompletion(result)         }      .focused($focusedField, equals: .search)         .onAppear {           focusedField = .search         }       }     }   }   var searchResults: [String] {     if searchText.isEmpty {       return itemsToSearch     } else {       return itemsToSearch.filter { $0.contains(searchText) }     }   } } struct ContentView_Previews: PreviewProvider {   static var previews: some View {     ContentView()   } } Can someone clarify if this is possible, and if so, where I am going wrong? Thanks in advance. Laith
0
0
2.3k
Mar ’22
Where is the demo project?
I would like to compare what I'm doing (wrongly, it seems) to the video. Where's the demo project? In short, I'm seeing that the runtime is complaining with [SwiftUI] 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. despite using @MainActor. And, it isn't clear where to instantiate the model object. I get a warning Expression requiring global actor 'MainActor' cannot appear in default-value expression of property '_manager'; this is an error in Swift 6 So while this is very promising, it is hard to discover the correct and modern way to implement asynchronous behavior in SwiftUI.
0
0
755
Mar ’22
Impossible to set up layout with view hierarchy unprepared for constraint.
After upgrading to ios15, there are many crashes. What is the reason?? -[UIView _layoutEngine_didAddLayoutConstraint:roundingAdjustment:mutuallyExclusiveConstraints:] + 468 -[UIView _tryToAddConstraint:roundingAdjustment:mutuallyExclusiveConstraints:] + 212 -[UIView(UIConstraintBasedLayout) nsli_addConstraint:]  -[UIView(UIConstraintBasedLayout) addConstraints:]_block_invoke + 176 0x000000019b069000 + 34296 -[UIView(UIConstraintBasedLayout) addConstraints:] + 196 -[UIInputWindowControllerHostingItem updateVisibilityConstraintsForPlacement:] + 440 -[UIInputWindowControllerHostingItem updateViewConstraints] + 6888 -[UIInputWindowControllerHosting updateViewConstraints] + -[UIInputWindowController updateViewConstraints] + 92 -[UIInputWindowController changeToInputViewSet:] + 2252 ___43-[UIInputWindowController setInputViewSet:]_block_invoke.1285 + 40 ___77-[UIInputWindowController moveFromPlacement:toPlacement:starting:completion:]_block_invoke.1042 + 1600 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 724 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 248 -[UIViewAnimationState animationDidStop:finished:] + 244 0x00000001861eb000 + 821768 libdispatch.dylib __dispatch_client_callout + 20
2
0
930
Mar ’22
Will the AppIcon automatically rounded in macOS 11?
Some context from the Human Interface Guidelines. It says that the AppIcon should be square in shape with no rounded edges. But when I build my app with the same image specs using Image Asset Catalog, it does not seems to be rounding the corners automagically. I know it does in iOS and iPadOS, but does it work macOS 11. And what about Icon shapes in older macOS Catalina? Will this change affect them. Square without rounded corners looks kinda ugly.
3
0
5.2k
Feb ’22
PHPickerViewController - can't get URL from PHPickerResult
Hi, I have a little issue with this new API PHPPickerViewController:  var configuration = PHPickerConfiguration()  configuration.filter = .any(of: [.images])  configuration.selectionLimit = 10  configuration.preferredAssetRepresentationMode = .compatible let picker = PHPickerViewController(configuration: configuration)  picker.delegate = self  present(picker, animated: true, completion: nil) func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) {   var selectedPhotosData : [Data] = []   for (index,result) in results.enumerated() { 				 result.itemProvider.loadFileRepresentation(forTypeIdentifier: "public.jpeg") { (url, error) in     guard let fileUrl = url else {return } print(fileUrl)      } } This code above doesn't work, I don't get the URL at all. I tried on Simulator and real device but the same problem. I tried loadObject function but I can't the UIImages... I saw some workarounds here but they don't work in my case it seems...
3
0
4k
Feb ’22
UISplitViewController - showDetailViewController(_ vc: UIViewController, sender: Any?) stacking view controllers.
Using UISplitViewController for displaying contact list and contact details screen. Primary, I have UITableViewController. On didSelectRow: set segue/programatically handle delegate to call showDetailViewControler. it always pushes viewController. Question is instead of replacing secondary why need to push. Most of solution I found that hide back button and keep on push and increasing navigation stack. Print this self.viewController(for: .secondary)?.navigationController?.viewControllers.count on segue/didSelectRow delegate. count keeps on increasing.
0
0
985
Feb ’22
How do I get a tab bar in iOS15 that looks like the one in iOS14?
I don't understand the changes made to the tab bar in iOS 15. In my app, I have a collection view that goes all the way down to the bottom of the screen. When the tab bar appears, it covers some of that collection view, which is fine. However, in iOS15, the tab bar has no background (and no blur effect), thus making the tab bar item text hard to see over the collection view. In interface builder, I tried turning on the "Scroll Edge" option. This gives a translucent background to the tab bar similar to what I had in iOS 14. Unfortunately, the menu tab bar item text size is affected by this option. For some reason, it doesn't use the font size I set, but something smaller. Why is this happening? How do I get it to use the correct font size? P.S. I'm only using text for the tab bar items. There are no images.
11
0
16k
Feb ’22
How to implement the right detail panel by swiftUI?
The video wwdc21-10062 claimed that by using swiftUI developers can build an app with a detail panel (like the right sidebar in Xcode), but didn't say how to implement that. I have tried to use HSplitView but failed. My code is like: var body: some View { NavigationView { Text("sidebar") HSplitView { Text("Primary View") Text("Detail Panel") } } }
3
0
2.2k
Feb ’22
Help!!! How to eliminate the ">" nav link symbol from list items?
Have spent 2 hours on this without success, and have not found any info on-line. I've put together a list of items (regular swiftui list) and when I add a Navigation Link, it modifies the list item view to add a ">" symbol to the right of the list item. This is the current code from the list view (calls a sub-view - that works perfect, but I don't want the ">" symbol appearing on each item. List ($viewModel.teams) { Team in NavigationLink(destination: GroupMembersView(user: user, team: Team)) { GroupsCellView(team: Team) }.buttonStyle(PlainButtonStyle()) }.listStyle(.plain) Here is a picture of the nav view & undesired symbol (symbol appears on the right hand side of every item in list): How can I remove this symbol? -thanks!
Replies
4
Boosts
0
Views
6.9k
Activity
Apr ’22
SF Symbols & Fonts - Commercial use
Are SF Symbols and other fonts provided available for commercial use? For example, in a marketing website.
Replies
1
Boosts
0
Views
1.6k
Activity
Apr ’22
NSPersistentCloudKitContainer Bug
I have been excited to add NSPersistentCloudKitContainer's share functionality to my app but I've noted a few thing I suspect are bugs: -When using share() on a NSManagedObject the share record is set up in a new zone. However, the root NSManagedObject's record is not being updated with the relationship linkage to the shared record. -Secondly, when you revoke a share, the cloudkit.share record is removed from iCloud, but not in the local data stores. This makes the fetchShares() method ineffective for detecting a missing cloudkit.share record. In order to re-share the root object the developer must call out to iCloud directly using the old methods to be sure if the share exists or not. I am using the code from Apple's 'Synchronizing a Local Store to the Cloud' sample. It would be nice if they added support for revoking shares into this sample and addressed these issues.
Replies
8
Boosts
0
Views
6.1k
Activity
Apr ’22
Project-Files used in the video.
Hello Apple-Team! I am looking for the projectfiles which are used in the WWDC Session wwdc20-10039, "Build document-based apps in SwiftUI“. Regards
Replies
0
Boosts
0
Views
631
Activity
Apr ’22
How Text Layout Manager generates Layout Fragment from Text Elements?
During the presentation (19:43) it says the NSTextLayoutFragment 'Layout information for one or more elements'. But from the documentation it seems that you can only generate a layout fragment from one NSTextElement. Besides there is only one property that associates a text element. What does it mean by 'parent element' anyway?
Replies
0
Boosts
0
Views
831
Activity
Apr ’22
Deleting a Share without deleting Objects
Hi, I wanted to offer the UI for editing and deleting a share. So for using UICloudSharingController(share: , container: ) I implemented the delegate to call "persistUpdatedShare" in "cloudSharingControllerDidSaveShare" func cloudSharingControllerDidSaveShare(_ csc: UICloudSharingController) { if let share = csc.share,   let privatePersistentStore = PersistenceController.shared.privatePersistentStore { PersistenceController.shared.container.persistUpdatedShare(share, in: privatePersistentStore) { (share, error) in Thread.performOnMain { if let error = error { PersistenceController.shared.storeWarning = error } } } } } and to call "purgeObjectsAndRecordsInZone" in "cloudSharingControllerDidStopSharing" func cloudSharingControllerDidStopSharing(_ csc: UICloudSharingController) { let puzzleToShare = puzzleToShare if let share = csc.share,   let privatePersistentStore = PersistenceController.shared.privatePersistentStore { PersistenceController.shared.container.purgeObjectsAndRecordsInZone(with: share.recordID.zoneID, in: privatePersistentStore) { (zoneID, error) in Thread.performOnMain { if let error = error { PersistenceController.shared.storeWarning = error } else { puzzleToShare.makePrivateDuplicate() try? puzzleToShare.puzzle.managedObjectContext?.save() } } } } } I got this implementation from a TSI, but it makes no sense to me to delete and duplicate my objects rather than just keeping them and only deleting the share. Question: How can I cleanly discontinue a share, but keep my data. Duplicating my objects seems such a weird approach. But without this implementation it does not really work. (I get strange behaviors and crashes) All the best Christoph
Replies
1
Boosts
0
Views
1.3k
Activity
Mar ’22
Is it possible to set Focus on .searchable in SwiftUI
I am trying to set the focus on the .searchable text entry field using @FocuseState and .focused($focusedField, equals: .search) technique demonstrated by Tanu in her WWDC21-10023 talk, but I'm not sure if it is a focusable element or how to programmatically set it. My attempt: //based on a technique presented in https://developer.apple.com/videos/play/wwdc2021/1002 and Paul Hudson's article https://www.hackingwithswift.com/quick-start/swiftui/how-to-add-a-search-bar-to-filter-your-data import SwiftUI enum Field: Hashable {   case search } struct ContentView: View {   let itemsToSearch = ["John", "Mark", "Adam", "Carol", "Ismael", "Vanessa", "Aniq"]   @FocusState private var focusedField: Field?   @State private var searchText = ""   var body: some View {     NavigationView {       List {         ForEach(searchResults, id: \.self) { itemsToSearch in           NavigationLink(destination: Text(itemsToSearch)) {             Text(itemsToSearch)           }         }       }       .searchable(text: $searchText, placement: .navigationBarDrawer(displayMode: .always)) {         ForEach(searchResults, id: \.self) { result in           Text("\(result)").searchCompletion(result)         }      .focused($focusedField, equals: .search)         .onAppear {           focusedField = .search         }       }     }   }   var searchResults: [String] {     if searchText.isEmpty {       return itemsToSearch     } else {       return itemsToSearch.filter { $0.contains(searchText) }     }   } } struct ContentView_Previews: PreviewProvider {   static var previews: some View {     ContentView()   } } Can someone clarify if this is possible, and if so, where I am going wrong? Thanks in advance. Laith
Replies
0
Boosts
0
Views
2.3k
Activity
Mar ’22
SwiftUI on the iPad: Build the interactive book on the iPad
How can I develop Children interactive Book for iPad with SwiftUI?
Replies
0
Boosts
0
Views
978
Activity
Mar ’22
Where is the demo project?
I would like to compare what I'm doing (wrongly, it seems) to the video. Where's the demo project? In short, I'm seeing that the runtime is complaining with [SwiftUI] 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. despite using @MainActor. And, it isn't clear where to instantiate the model object. I get a warning Expression requiring global actor 'MainActor' cannot appear in default-value expression of property '_manager'; this is an error in Swift 6 So while this is very promising, it is hard to discover the correct and modern way to implement asynchronous behavior in SwiftUI.
Replies
0
Boosts
0
Views
755
Activity
Mar ’22
Impossible to set up layout with view hierarchy unprepared for constraint.
After upgrading to ios15, there are many crashes. What is the reason?? -[UIView _layoutEngine_didAddLayoutConstraint:roundingAdjustment:mutuallyExclusiveConstraints:] + 468 -[UIView _tryToAddConstraint:roundingAdjustment:mutuallyExclusiveConstraints:] + 212 -[UIView(UIConstraintBasedLayout) nsli_addConstraint:]  -[UIView(UIConstraintBasedLayout) addConstraints:]_block_invoke + 176 0x000000019b069000 + 34296 -[UIView(UIConstraintBasedLayout) addConstraints:] + 196 -[UIInputWindowControllerHostingItem updateVisibilityConstraintsForPlacement:] + 440 -[UIInputWindowControllerHostingItem updateViewConstraints] + 6888 -[UIInputWindowControllerHosting updateViewConstraints] + -[UIInputWindowController updateViewConstraints] + 92 -[UIInputWindowController changeToInputViewSet:] + 2252 ___43-[UIInputWindowController setInputViewSet:]_block_invoke.1285 + 40 ___77-[UIInputWindowController moveFromPlacement:toPlacement:starting:completion:]_block_invoke.1042 + 1600 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 724 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 248 -[UIViewAnimationState animationDidStop:finished:] + 244 0x00000001861eb000 + 821768 libdispatch.dylib __dispatch_client_callout + 20
Replies
2
Boosts
0
Views
930
Activity
Mar ’22
How to delete built in version
[ wwdc20-10640 https://developer.apple.com/forums/tags/wwdc20-10640 Discuss WWDC20 Session 10640 - Design for the iPadOS pointer )
Replies
1
Boosts
0
Views
554
Activity
Mar ’22
SwiftUI Video Player
Which talk did Apple introduce the SwiftUI VideoPlayer specifically?
Replies
1
Boosts
0
Views
512
Activity
Mar ’22
Will the AppIcon automatically rounded in macOS 11?
Some context from the Human Interface Guidelines. It says that the AppIcon should be square in shape with no rounded edges. But when I build my app with the same image specs using Image Asset Catalog, it does not seems to be rounding the corners automagically. I know it does in iOS and iPadOS, but does it work macOS 11. And what about Icon shapes in older macOS Catalina? Will this change affect them. Square without rounded corners looks kinda ugly.
Replies
3
Boosts
0
Views
5.2k
Activity
Feb ’22
PHPickerViewController - can't get URL from PHPickerResult
Hi, I have a little issue with this new API PHPPickerViewController:  var configuration = PHPickerConfiguration()  configuration.filter = .any(of: [.images])  configuration.selectionLimit = 10  configuration.preferredAssetRepresentationMode = .compatible let picker = PHPickerViewController(configuration: configuration)  picker.delegate = self  present(picker, animated: true, completion: nil) func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) {   var selectedPhotosData : [Data] = []   for (index,result) in results.enumerated() { 				 result.itemProvider.loadFileRepresentation(forTypeIdentifier: "public.jpeg") { (url, error) in     guard let fileUrl = url else {return } print(fileUrl)      } } This code above doesn't work, I don't get the URL at all. I tried on Simulator and real device but the same problem. I tried loadObject function but I can't the UIImages... I saw some workarounds here but they don't work in my case it seems...
Replies
3
Boosts
0
Views
4k
Activity
Feb ’22
UISplitViewController - showDetailViewController(_ vc: UIViewController, sender: Any?) stacking view controllers.
Using UISplitViewController for displaying contact list and contact details screen. Primary, I have UITableViewController. On didSelectRow: set segue/programatically handle delegate to call showDetailViewControler. it always pushes viewController. Question is instead of replacing secondary why need to push. Most of solution I found that hide back button and keep on push and increasing navigation stack. Print this self.viewController(for: .secondary)?.navigationController?.viewControllers.count on segue/didSelectRow delegate. count keeps on increasing.
Replies
0
Boosts
0
Views
985
Activity
Feb ’22
How do I get a tab bar in iOS15 that looks like the one in iOS14?
I don't understand the changes made to the tab bar in iOS 15. In my app, I have a collection view that goes all the way down to the bottom of the screen. When the tab bar appears, it covers some of that collection view, which is fine. However, in iOS15, the tab bar has no background (and no blur effect), thus making the tab bar item text hard to see over the collection view. In interface builder, I tried turning on the "Scroll Edge" option. This gives a translucent background to the tab bar similar to what I had in iOS 14. Unfortunately, the menu tab bar item text size is affected by this option. For some reason, it doesn't use the font size I set, but something smaller. Why is this happening? How do I get it to use the correct font size? P.S. I'm only using text for the tab bar items. There are no images.
Replies
11
Boosts
0
Views
16k
Activity
Feb ’22
SwiftUI ScrollView and LazyVStack issue
Bouncing from top to bottom won’t work properly. It’s working only when load some content more than screen height size… iOS14! But, on iOS 15 all work like created
Replies
0
Boosts
0
Views
1.1k
Activity
Feb ’22
SwiftUI stack navigation on macOS?
Currently NaviagitonView on macOS creates a side panel. And then navigationViewStyle does not support stack view for macOS. Given this, is there currently a method to totally switch the content of a window from one view to another on macOS?
Replies
0
Boosts
0
Views
1.3k
Activity
Feb ’22
How to implement the right detail panel by swiftUI?
The video wwdc21-10062 claimed that by using swiftUI developers can build an app with a detail panel (like the right sidebar in Xcode), but didn't say how to implement that. I have tried to use HSplitView but failed. My code is like: var body: some View { NavigationView { Text("sidebar") HSplitView { Text("Primary View") Text("Detail Panel") } } }
Replies
3
Boosts
0
Views
2.2k
Activity
Feb ’22
Creating Interactive Children Book with SpriteKit
Any example of a complete project to follow in order to create an Interactive Children Book with SpriteKit?
Replies
0
Boosts
0
Views
650
Activity
Feb ’22