Post

Replies

Boosts

Views

Activity

Reply to Share via Context Menu Button
It appears that the ShareLink can be added, alongside other buttons, within the .contextMenu as below. .contextMenu { Button(action: { debugPrint("Share") }) { Label("Share", systemImage: "square.and.arrow.up") } ShareLink(item: image, preview: SharePreview("image", image: image)) { Label("Share", systemImage: "square.and.arrow.up") } }
1w
Reply to Best Way to Support Different Devices in SwiftUI?
Using ViewThatFits is definitely the recommended approach to getting a user interface that adapts to different devices and also different device orientations (e.g. landscape vs. portrait). As with many other aspects of Swift and SwiftUI, ViewThatFits takes a little time to get used to. The first view within ViewThatFits should be the largest view with progressively smaller views coming next. Use the in: parameter to specify whether the view should assess the size horizontally or vertically, as this example shows: ViewThatFits will choose the first child view that fits. While it can be used without the in: parameter, it usually doesn’t provide the required result unless it’s specified. ViewThatFits(in: .horizontal) { HStack { // Large View } HStack { // Medium View } HStack { // Small View } }
4w