Technology-specific views
Use SwiftUI views that other Apple frameworks provide.
Overview
To access SwiftUI views that another framework defines, import both SwiftUI and the other framework into the file where you use the view. You can find the framework to import by looking at the availability information on the view’s documentation page.
[Image]
For example, to use the Map view in your app, import both SwiftUI and MapKit.
import SwiftUI
import MapKit
struct MyMapView: View {
// Center the map on Joshua Tree National Park.
var region = MKCoordinateRegion(
center: CLLocationCoordinate2D(latitude: 34.011_286, longitude: -116.166_868),
span: MKCoordinateSpan(latitudeDelta: 0.2, longitudeDelta: 0.2)
)
var body: some View {
Map(initialPosition: .region(region))
}
}For design guidance, see Technologies in the Human Interface Guidelines.
Topics
Displaying web content
WebViewWebPageonWebViewImmersiveEnvironmentRequest(shouldAllow:present:dismiss:)webViewBackForwardNavigationGestures(_:)webViewContentBackground(_:)webViewContextMenu(menu:)webViewElementFullscreenBehavior(_:)webViewLinkPreviews(_:)webViewMagnificationGestures(_:)webViewOnScrollGeometryChange(for:of:action:)webViewScrollInputBehavior(_:for:)webViewScrollPosition(_:)webViewTextSelection(_:)
Accessing Apple Pay and Wallet
PayWithApplePayButtonAddPassToWalletButtonVerifyIdentityWithWalletButtonaddOrderToWalletButtonStyle(_:)addPassToWalletButtonStyle(_:)onApplePayCouponCodeChange(perform:)onApplePayPaymentMethodChange(perform:)onApplePayShippingContactChange(perform:)onApplePayShippingMethodChange(perform:)payLaterViewAction(_:)payLaterViewDisplayStyle(_:)payWithApplePayButtonDisableCardArt()payWithApplePayButtonStyle(_:)verifyIdentityWithWalletButtonStyle(_:)AsyncShareablePassConfigurationtransactionTask(_:action:)
Authorizing and authenticating
LocalAuthenticationViewSignInWithAppleButtonsignInWithAppleButtonStyle(_:)authorizationControllerwebAuthenticationSession
Configuring Family Sharing
FamilyActivityPickerfamilyActivityPicker(isPresented:selection:)familyActivityPicker(headerText:footerText:isPresented:selection:)familyActivityPicker(title:headerText:footerText:isPresented:selection:)
Reporting on device activity
Working with managed devices
Creating graphics
Getting location information
LocationButtonMapmapStyle(_:)mapScope(_:)mapFeatureSelectionDisabled(_:)mapFeatureSelectionAccessory(_:)mapFeatureSelectionContent(content:)mapControls(_:)mapControlVisibility(_:)mapCameraKeyframeAnimator(trigger:keyframes:)lookAroundViewer(isPresented:scene:allowsNavigation:showsRoadLabels:pointsOfInterest:onDismiss:)lookAroundViewer(isPresented:initialScene:allowsNavigation:showsRoadLabels:pointsOfInterest:onDismiss:)onMapCameraChange(frequency:_:)mapItemDetailPopover(isPresented:item:displaysMap:attachmentAnchor:)mapItemDetailPopover(isPresented:item:displaysMap:attachmentAnchor:arrowEdge:)mapItemDetailPopover(item:displaysMap:attachmentAnchor:)mapItemDetailPopover(item:displaysMap:attachmentAnchor:arrowEdge:)mapItemDetailSheet(isPresented:item:displaysMap:)mapItemDetailSheet(item:displaysMap:)
Displaying media
CameraViewNowPlayingViewVideoPlayercontinuityDevicePicker(isPresented:onDidConnect:)cameraAnchor(isActive:)foveatedStreamingPauseSheet(session:)
Supporting Group Activities
Selecting photos
PhotosPickerphotosPicker(isPresented:selection:matching:preferredItemEncoding:)photosPicker(isPresented:selection:matching:preferredItemEncoding:photoLibrary:)photosPicker(isPresented:selection:maxSelectionCount:selectionBehavior:matching:preferredItemEncoding:)photosPicker(isPresented:selection:maxSelectionCount:selectionBehavior:matching:preferredItemEncoding:photoLibrary:)photosPickerAccessoryVisibility(_:edges:)photosPickerDisabledCapabilities(_:)photosPickerSearchText(_:)photosPickerStyle(_:)photosPickerMetadataOptions(_:)photosSharedAlbumCreationSheet(isPresented:defaultTitle:defaultSharingPolicy:photoLibrary:onCompletion:)photosSharedAlbumCustomizationSheet(isPresented:albumIdentifier:photoLibrary:onCompletion:)photosSharedAlbumPostingSheet(isPresented:items:defaultAlbumIdentifier:photoLibrary:completion:)
Generating images
imagePlaygroundGenerationStyle(_:in:)imagePlaygroundOptions(_:)imagePlaygroundSheet(isPresented:concept:sourceImage:onCompletion:onCancellation:)imagePlaygroundSheet(isPresented:concept:sourceImage:onCompletion:onAdaptiveImageGlyphCreation:onCancellation:)imagePlaygroundSheet(isPresented:concept:sourceImageURL:onCompletion:onCancellation:)imagePlaygroundSheet(isPresented:concept:sourceImageURL:onCompletion:onAdaptiveImageGlyphCreation:onCancellation:)imagePlaygroundSheet(isPresented:concepts:sourceImage:onCompletion:onCancellation:)imagePlaygroundSheet(isPresented:concepts:sourceImage:onCompletion:onAdaptiveImageGlyphCreation:onCancellation:)imagePlaygroundSheet(isPresented:concepts:sourceImageURL:onCompletion:onCancellation:)imagePlaygroundSheet(isPresented:concepts:sourceImageURL:onCompletion:onAdaptiveImageGlyphCreation:onCancellation:)
Previewing content
Interacting with networked devices
Configuring a Live Activity
Interacting with the App Store and Apple Music
appStoreOverlay(isPresented:configuration:)manageSubscriptionsSheet(isPresented:)refundRequestSheet(for:isPresented:onDismiss:)offerCodeRedemption(options:isPresented:onCompletion:)musicPicker(isPresented:title:selection:)musicSubscriptionOffer(isPresented:options:onLoadCompletion:)currentEntitlementTask(for:priority:action:)inAppPurchaseOptions(_:)manageSubscriptionsSheet(isPresented:subscriptionGroupID:)onInAppPurchaseCompletion(perform:)onInAppPurchaseStart(perform:)productIconBorder()productViewStyle(_:)productDescription(_:)storeButton(_:for:)storeProductTask(for:priority:action:)storeProductsTask(for:priority:action:)subscriptionStatusTask(for:priority:action:)subscriptionStoreButtonLabel(_:)subscriptionStoreControlIcon(icon:)subscriptionStoreControlStyle(_:)subscriptionStoreControlStyle(_:placement:)subscriptionStoreOptionGroupStyle(_:)subscriptionStorePickerItemBackground(_:)subscriptionStorePickerItemBackground(_:in:)subscriptionStorePolicyDestination(for:destination:)subscriptionStorePolicyDestination(url:for:)subscriptionStorePolicyForegroundStyle(_:)subscriptionStorePolicyForegroundStyle(_:_:)subscriptionStoreSignInAction(_:)subscriptionStoreControlBackground(_:)subscriptionPromotionalOffer(offer:compactJWS:)subscriptionIntroductoryOffer(applyOffer:compactJWS:)subscriptionOfferViewButtonVisibility(_:for:)subscriptionOfferViewDetailAction(_:)subscriptionOfferViewStyle(_:)preferredSubscriptionOffer(_:)preferredSubscriptionPricingTerms(_:)
Accessing health data
healthDataAccessRequest(store:objectType:predicate:trigger:completion:)healthDataAccessRequest(store:readTypes:trigger:completion:)healthDataAccessRequest(store:shareTypes:readTypes:trigger:completion:)workoutPreview(_:isPresented:)
Providing tips
popoverTip(_:arrowEdge:action:)popoverTip(_:isPresented:attachmentAnchor:arrowEdge:action:)popoverTip(_:isPresented:attachmentAnchor:arrowEdges:action:)tipAnchor(_:)tipBackground(_:)tipBackgroundInteraction(_:)tipCornerRadius(_:antialiased:)tipImageSize(_:)tipViewStyle(_:)tipImageStyle(_:)tipImageStyle(_:_:)tipImageStyle(_:_:_:)
Showing a translation
translationPresentation(isPresented:text:attachmentAnchor:arrowEdge:replacementAction:)translationTask(_:action:)translationTask(source:target:action:)translationTask(source:target:preferredStrategy:action:)
Presenting journaling suggestions
journalingSuggestionsPicker(isPresented:onCompletion:)journalingSuggestionsPicker(isPresented:journalingSuggestionToken:onCompletion:)
Managing contact access
contactAccessButtonCaption(_:)contactAccessButtonStyle(_:)contactAccessPicker(isPresented:completionHandler:)