This package is based on the package ARKit-FocusNode, but adapted to work in Apple's Augmented Reality framework, RealityKit.
The Example looks identical to the above GIF, which uses the FESquare class (Focus Entity Square).
There is a crashing bug when using this library with iOS 13.2 and importing via Swift Package Manager
The Swift bug has been reported here: https://bugs.swift.org/browse/SR-11564
And there is a temporary solution, which involves setting the "Dead Code Stripping" property in your build's target to "No"
Target > Build Settings > Linking > Dead Code Stripping
- Swift 5.0
- iOS 13.0 (RealityKit)
- Xcode 11
If you're unfamiliar with using RealityKit, I would also recommend reading my articles on Getting Started with RealityKit.
Add the URL of this repository to your Xcode 11+ Project.
https://github.com/maxxfrazer/FocusEntity.git
See the Example for a full working example as can be seen in the GIF above
- After installing, import
FocusEntity
to your .swift file - Create an instance of
let focusSquare = FESquare()
, or anotherFocusEntity
class. - Set
focusSquare.viewDelegate
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.
I'm hoping to make the animations look a little smoother over time, but any and all contributions are welcome and encouraged.
Please follow the guide for creating GitHub Issues, otherwise I may simply close them.
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.