Posts

Post not yet marked as solved
0 Replies
520 Views
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.
Posted
by nkalvi.
Last updated
.
Post marked as solved
2 Replies
1k Views
Sample code fails to compile with Xcode 14.1 beta 3 (14B5033e) as contextAction has been removed/replaced. // Compile error: Value of type 'some View' has no member 'contextAction' #if os(macOS) .contextAction(forSelectionType: Book.ID.self) { books in It looks like it has been replaced with contextMenu(forSelectionType:menu) with a slight difference.
Posted
by nkalvi.
Last updated
.
Post not yet marked as solved
2 Replies
867 Views
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+/: ^
Posted
by nkalvi.
Last updated
.
Post not yet marked as solved
1 Replies
1.3k Views
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 } }
Posted
by nkalvi.
Last updated
.
Post not yet marked as solved
1 Replies
732 Views
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)         }
Posted
by nkalvi.
Last updated
.