Post not yet marked as solved
Are SF Symbols and other fonts provided available for commercial use? For example, in a marketing website.
Post not yet marked as solved
In iOS 15 SDK you added the new FocusState API in SwiftUI. However there is no discussion or explanation anywhere that I could find, which explains:
What exactly is "focus"?
What isn't focus?
What is the relationship between FocusState and accessibility focus?
What is the relationship between whether a SecureField is being edited, and whether it's "focused"?
Example:
Lets say my tvOS app has an on-screen keyboard, where the user uses the remote's directional controls to move focus around to the letter buttons. To enter their password, they focus the password field, then click the center button to activate it. Now that it's active, they move focus to each letter of their password and click on each one: P... A... S... S... W... R... D... !... then they move focus to the "Submit" button and click.
In this case, while the SecureField is being edited, focus moves around to a bunch of different buttons.
The point of this example is that, if SecureField had a public "isBeingEdited" property, then it would be TRUE even while the field is not focused.
However most Workday's designers interpret "focused" as being totally equivalent to "isBeingEdited" because in a web browser, tabbing out of a field makes it stop being edited.
What is Apple's intent here? When not using a remote or physical keyboard or screen-reader, how is focus supposed to relate to whether a field is being edited? Does this relationship change when a user now has a bluetooth keyboard connected and Full Keyboard Access is turned ON? How does this correlate with accessibility focus?
I cannot find any documentation from Apple that explains what focus is, or how this is supposed to work in SwiftUI in the various different scenarios where the concept of "focus" is relevant. Do you have a link to something current that explains how it's supposed to work so that we will know if there's a bug?
Last question: how can we make the iOS simulator treat the physical keyboard as if it was a bluetooth keyboard to be used for focus-based keyboard navigation?
Post not yet marked as solved
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.
Post not yet marked as solved
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
Post not yet marked as solved
Hi, the video was great and on point, but it only featured UIKit apis.
3 years into the SwiftUI transition, I wonder if this is a UIKit only feature or can we also use it if we chose SwiftUI to build our apps ?
Thanks
Post not yet marked as solved
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?
Post not yet marked as solved
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
Post not yet marked as solved
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
Post not yet marked as solved
How can I develop Children interactive Book for iPad with SwiftUI?
Post not yet marked as solved
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.
Post not yet marked as solved
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
Post not yet marked as solved
[
wwdc20-10640
https://developer.apple.com/forums/tags/wwdc20-10640
Discuss WWDC20 Session 10640 - Design for the iPadOS pointer
)
Post not yet marked as solved
Which talk did Apple introduce the SwiftUI VideoPlayer specifically?
Post not yet marked as solved
In my application using UICollectionViewDiffableDataSource and compositional layout, I saw this exception
Thread 1: "This solver does not handle estimated items so this method does nothing. Are you calling this in error?"
that was thrown in dataSource.apply(snapshot, animatingDifferences: animated).
I don't understand what it is telling me and how I should fix it. Any idea?
Post not yet marked as solved
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.
Post not yet marked as solved
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...
Post not yet marked as solved
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.
Post not yet marked as solved
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.
Post not yet marked as solved
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
Post not yet marked as solved
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?