Skip to content

Commit

Permalink
removed some \'if simulator\' statements, added initialisers so that …
Browse files Browse the repository at this point in the history
…simulator will compile with same code as device
  • Loading branch information
maxxfrazer committed Nov 19, 2021
1 parent c1db612 commit 3a7e4db
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 0 additions & 2 deletions Sources/FocusEntity/FocusEntity+Segment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// Copyright © 2019 Max Cobb. All rights reserved.
//

#if canImport(ARKit) && !targetEnvironment(simulator)
import RealityKit

internal extension FocusEntity {
Expand Down Expand Up @@ -154,4 +153,3 @@ internal extension FocusEntity {

}
}
#endif
14 changes: 10 additions & 4 deletions Sources/FocusEntity/FocusEntity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
// Copyright © 2019 Max Cobb. All rights reserved.
//

#if canImport(ARKit) && !targetEnvironment(simulator)
import RealityKit
#if canImport(RealityFoundation)
import RealityFoundation
#endif

#if canImport(ARKit) && !targetEnvironment(simulator)
import ARKit
import Combine

Expand Down Expand Up @@ -330,9 +331,14 @@ open class FocusEntity: Entity, HasAnchoring, HasFocusEntity {
FocusEntity is only enabled for environments which can import ARKit.
*/
open class FocusEntity {
init?() {
print("This is not supported when ARKit cannot be imported.")
return nil
public convenience init(on arView: ARView, style: FocusEntityComponent.Style) {
self.init(on: arView, focus: FocusEntityComponent(style: style))
}
public convenience init(on arView: ARView, focus: FocusEntityComponent) {
self.init()
}
internal init() {
print("This is not supported when ARKit cannot be imported or using the simulator.")
}
}
#endif
2 changes: 0 additions & 2 deletions Sources/FocusEntity/FocusEntityComponent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// Copyright © 2019 Max Cobb. All rights reserved.
//

#if canImport(ARKit) && !targetEnvironment(simulator)
import RealityKit
import ARKit

Expand Down Expand Up @@ -86,4 +85,3 @@ public struct FocusEntityComponent: Component {
}
}
}
#endif

0 comments on commit 3a7e4db

Please sign in to comment.