Swiftpack.co -  SAP/cloud-sdk-ios-fioriarkit as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
SAP/cloud-sdk-ios-fioriarkit
SAP Fiori for iOS ARKit
.package(url: "https://github.com/SAP/cloud-sdk-ios-fioriarkit.git", from: "1.0.0")


SAP Fiori for iOS ARKit




Summary

This project is a SwiftUI implementation of the SAP Fiori for iOS ARKit, and is meant to leverage the Augmented Reality capabilities from the frameworks provided by Apple for various Enterprise use cases.

There is currently support for AR Cards. This refers to Cards that match with a corresponding Marker that represent annotations relative to an image or object in the real world.

AR Cards

https://user-images.githubusercontent.com/77754056/121744202-2ea88c80-cac8-11eb-811d-9c9edb6423fa.mp4

The AR Cards use case is essentially annotating the real world represented by a marker that corresponds to data displayed in a card with an optional action. SwiftUI is used to render the content at these positions since 3D modeling is expensive, tedious, and time consuming. There is a one to one mapping of markers to cards. The current strategy supported for scene creation is by using Reality Composer. Within Reality Composer a scene of annotations can be composed relative to an image or object. Data that's associated with these real world positions can be loaded and matched into it's respective Card. Supports Image and Object anchors.

The Cards and Markers can also leverage SwiftUI Viewbuilders allowing for custom designs.

Usage

Reality Composer Strategy

Composing the scene
  1. Open the Reality Composer app and create a scene with an image or object anchor
  2. Choose an image or scan an object and give the scene a name e.g. ExampleScene
  3. Place spheres in the desired position
  4. Preview in AR to fine tune
  5. Name the spheres with a type that conforms to LosslessStringConvertable
  6. The name of the sphere will correspond to the CardItemModel ID
  7. Add the rcproject file in your xcode project

Notes:

  • Reality Composer is required to scan an object when choosing an Object Anchor.
  • Scanning an object requires using an iOS device in the Reality Composer app
  • The spheres are for scene creation and will be invisible in the ARCards scene

rcDemo1        rcDemo2

Data Consumption

CardItem Models Conform to CardItemComponent. The name of the Entity (Sphere) from Reality Composer corresponds to the id property of the Model. The list of initial CardItems are passed into the RealityComposerStrategy with the Reality Composer rcproject File Name and the name of the scene. For an image Anchor, the image that will be detected must be passed into the strategy to create an ARReferenceImage.

Creating the ContentView and loading the data
struct FioriARKitCardsExample: View {
    @StateObject var arModel = ARAnnotationViewModel<ExampleCardModel>()
    
    var body: some View {
    /**
     Initializes an AR Experience with a Scanning View flow with Markers and Cards upon anchor discovery

     - Parameters:
        - arModel: The View Model which handles the logic for the AR Experience
        - image: The image which will be displayed in the Scanning View
        - cardAction: Card Action
    */
        SingleImageARCardView(arModel: arModel, image: Image("qrImage"), cardAction: { id in
            // action to pass to corresponding card from the CardItemModel ID
        })
        .onAppear(perform: loadInitialData)
    }

    func loadInitialData() {
        let cardItems = [ExampleCardModel(id: "WasherFluid", title_: "Recommended Washer Fluid"), ExampleCardModel(id: "OilStick", title_: "Check Oil Stick")]
        guard let anchorImage = UIImage(named: "qrImage") else { return }
        let loadingStrategy = RealityComposerStrategy(cardContents: cardItems, anchorImage: anchorImage, physicalWidth: 0.1, rcFile: "realityComposerFileName", rcScene: "sceneName")
        arModel.load(loadingStrategy: loadingStrategy)
    }
}

Requirements

  • iOS 14 or higher
  • Xcode 12 or higher
  • Reality Composer 1.1 or higher
  • Swift Package Manager

Installation

The package is intended for consumption via Swift Package Manager.

  • To add to your application target, navigate to the Project Settings > Swift Packages tab, then add the repository URL.
  • To add to your framework target, add the repository URL to your Package.swift manifest.

In both cases, xcodebuild tooling will manage cloning and updating the repository to your app or framework project.

Configuration

FioriARKit as umbrella product currently will contain everything the package as to offer. As the package evolves the package could be split into multiple products for different use cases.

Limitations

The module is currently in development, and should not yet be used productively. Breaking changes may occur in 0.x.x release(s)

Key gaps which are present at time of open-source project launch:

  • An authoring flow for pinning/editing an annotation in app
  • An Annotation Loading Strategy which loads an array of positions for annotations relative to the detected image/object
  • While Reality Composer is useful for scene creation, editing the scene programmatically is possible, but those changes cannot be saved to the file

Known Issues

See Limitations.

How to obtain support

Support for the modules is provided thorough this open-source repository. Please file Github Issues for any issues experienced, or questions.

Contributing

If you want to contribute, please check the Contribution Guidelines

To-Do (upcoming changes)

See Limitations.

Examples

Functionality can be further explored with a demo app which is already part of this package (Apps/Examples/Examples.xcodeproj).

GitHub

link
Stars: 5
Last commit: 4 days ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

4 days ago
  • Initial release! 🎉
  • Support for AR Cards, see README for more information

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API