This package was inspired by Apple's examples and Max Frazer's package and is alternative to FocusEntity except that this package uses RayCasting method instead of HitTest
- Swift 5.0
- iOS 13.0 (RealityKit)
- Xcode 11
If you're unfamiliar with using RealityKit, I would also recommend reading Max Frazer's articles on Getting Started with RealityKit.
Add the URL of this repository to your Xcode 11+ Project.
https://github.com/deebov/FocusEntity.git
See the Example for a full working example using SwiftUI
- After installing, import
FocusEntity
to your .swift file - Create an instance of
let focusSquare = FocusSquare()
, or anotherFocusEntity
class. - Set
focusSquare.arViewDelegate
to theARView
it is to be rendered within. - Set the FocusEntity to auto-update:
focusSquare.setAutoUpdate(to: true)
If something's not making sense in the Example, send me a tweet or Fork & open a Pull Request on this repository to make something more clear.
The original code to create this repository has been adapted from one of Apple's examples from 2018, license also included. I have merely adapted the code to be used and distributed from within a Swift Package, and now further adapted to work with RealityKit.