Annotation Viewing

  • Content View which displays the card and marker views after a discovery flow for a single Image in the scene after the discoveryFlowHasFinished has been set to True. Only displays the views which are set to isVisible. Cards and Markers are initially set to isVisible.

    Usage

    // Constructor for Default ScanningView, CardView, and MarkerView
    ARAnnotationsView(arModel: arModel,
                          image: Image("qrImage"),
                          cardAction: { id in
                                // set the card action for id corresponding to the CardItemModel
                                print(id)
                          })
            .onAppear(perform: loadData)
    
    // Constructors with viewbuilders for each combination of Views
    // Use the CarouselOptions View Modifier to adjust the behavior of the Carousel
    ARAnnotationsView(arModel: arModel,
                          scanLabel: { anchorPosition in
                              CustomScanView(image: Image("qrImage"), position: anchorPosition)
                          },
                          cardLabel: { cardmodel, isSelected in
                              CustomCardView(networkModel: cardmodel, isSelected: isSelected)
                          },
                          markerLabel: { state, icon  in
                              CustomMarkerView(state: state)
                          })
            .carouselOptions(CarouselOptions(itemSpacing: 5, carouselHeight: 200, alignment: .center))
            .onAppear(perform: loadData)
    
    func loadData() {
        let cardItems = Tests.cardItems
        guard let anchorImage = UIImage(named: "qrImage") else { return }
        let strategy = RealityComposerStrategy(cardContents: cardItems, anchorImage: anchorImage, rcFile: "ExampleRC", rcScene: "ExampleScene")
        arModel.load(loadingStrategy: strategy)
    }
    
    See more

    Declaration

    Swift

    public struct ARAnnotationsView<Scan, Card, Marker, CardItem> : View where Scan : View, Card : View, Marker : View, CardItem : CardItemModel

    Parameters

    arModel

    The ViewModel which managers the AR Experience

    guideImage

    The image that is provided to the ScanView which displays what should be discovered for in the physical scene for the user

    scanLabel

    View Builder for a custom Scanning View. After the Image/Object has been discovered there is a 3 second delay until the ContentView displays Markers and Cards

    cardLabel

    View Builder for a custom CardView

    markerLabel

    View Builder for a custom MarkerView

  • Scanning View which displays a collapsable image to display for anchor detection. The anchor is still detectable when uncollapsed and the View will fade out after detection.

    See more

    Declaration

    Swift

    public struct ARScanView : View
  • A MarkerView to display the location of an Annotation backed by a real world location

    See more

    Declaration

    Swift

    public struct MarkerView : View
  • A CardView to display data which maps to an annotation represent in the real world.

    Usage:

     CardView(model: cardItem, isSelected: isSelected, action: cardAction)
    
    See more

    Declaration

    Swift

    public struct CardView<Title, Subtitle, DetailImage, ActionText, CardItem> : View where Title : View, Subtitle : View, DetailImage : View, ActionText : View, CardItem : CardItemModel