Post

Replies

Boosts

Views

Activity

Issues with ShareLink under macOS (with sample code updated on March 1, 2023)
struct ShareButton: View { ... let byLine = currentlyReading.book.byLine ShareLink( item: image, message: Text(byLine), preview: SharePreview(byLine, image: image)) When sharing a book, the following is logged in console and the message field is not filled by byline as expected: BookClub[14058:2642949] [NSExtension] Extension request contains input items but the extension point does not specify a set of allowed payload classes. The extension point's NSExtensionContext subclass must implement `+_allowedItemPayloadClasses`. This must return the set of allowed NSExtensionItem payload classes. In future, this request will fail with an error.
1
1
587
Apr ’23
Regex case match fails to compile in Xcode 14.0 (14A309)
import RegexBuilder switch "abc" { case /\w+/: print("It's a word!") } Gives an error: expression failed to parse: error: x.xcplaygroundpage:7:6: error: expression pattern of type 'Regex<Substring>' cannot match values of type 'String' case /\w+/: ^ x.xcplaygroundpage:7:6: note: overloads for '~=' exist with these partially matching parameter lists: (Substring, String) case /\w+/: ^
3
1
956
Sep ’22
.fileExporter issue
In sample code Building a Great Mac App with SwiftUI | Apple Developer Documentation, selecting Export… from the menu does nothing. It looks like .fileExporter needs to be applied to the the enclosing Section instead of the Button. CommandGroup(replacing: .importExport) { Section { Button("Export…") { isShowingExportDialog = true } } // Doesn't work when it is applied to the button, // but works when applied to the section .fileExporter( isPresented: $isShowingExportDialog, document: store, contentType: Store.readableContentTypes.first!) { result in } }
1
0
1.5k
Aug ’22
How to use NavigationSplitView instead of NavigationView where binding was used
It looks like passing a binding (instead of value) to a detail view is not possible with NavigationSplitView. For example, how to adopt NavigationSplitView in sample app Date Planner — Sample Apps Tutorials | Apple Developer Documentation does not seem straight forward. The only way seems to be to use ObservableObjects and use separate update methods on data. ...     ForEach(eventData.sortedEvents(period: period)) { $event in         NavigationLink {             EventEditor(event: $event)         } label: {             EventRow(event: event)         }
1
0
879
Jul ’22