Skip to content

Commit

Permalink
merged workflow files, swiftlint fixed focusentity.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
maxxfrazer committed Oct 31, 2022
1 parent 9afe6a7 commit 9d83ea6
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 64 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/swift-build-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: swiftlint

on:
push:
branches:
- "main"
pull_request:
branches:
- "*"

jobs:
build:
runs-on: macos-latest
steps:
- name: Checkout 🛎
uses: actions/checkout@v3
- name: Swift Lint 🧹
run: swiftlint --strict
- name: Test Build 🔨
run: xcodebuild -scheme $SCHEME -destination $DESTINATION
env:
SCHEME: FocusEntity
DESTINATION: generic/platform=iOS
25 changes: 0 additions & 25 deletions .github/workflows/swift-build.yml

This file was deleted.

19 changes: 0 additions & 19 deletions .github/workflows/swift-lint.yml

This file was deleted.

24 changes: 4 additions & 20 deletions Sources/FocusEntity/FocusEntity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,6 @@ public extension FocusEntityDelegate {
*/
open class FocusEntity: Entity, HasAnchoring, HasFocusEntity {

public enum FEError: Error {
case noScene
}

private var myScene: Scene? {
self.arView?.scene
}

internal weak var arView: ARView?

/// For moving the FocusEntity to a whole new ARView
Expand Down Expand Up @@ -134,7 +126,7 @@ open class FocusEntity: Entity, HasAnchoring, HasFocusEntity {
self.updateCancellable?.cancel()
if autoUpdate {
#if canImport(ARKit)
self.updateCancellable = self.myScene?.subscribe(
self.updateCancellable = self.arView?.scene.subscribe(
to: SceneEvents.Update.self, self.updateFocusEntity
)
#endif
Expand Down Expand Up @@ -205,10 +197,8 @@ open class FocusEntity: Entity, HasAnchoring, HasFocusEntity {

/// Whether FocusEntity is on a plane or not.
public internal(set) var onPlane: Bool = false

/// Indicates if the square is currently being animated.
public internal(set) var isAnimating = false

/// Indicates if the square is currently changing its alignment.
public internal(set) var isChangingAlignment = false

Expand Down Expand Up @@ -272,7 +262,6 @@ open class FocusEntity: Entity, HasAnchoring, HasFocusEntity {
self.focus = focus
self.name = "FocusEntity"
self.orientation = simd_quatf(angle: .pi / 2, axis: [1, 0, 0])

self.addChild(self.positioningEntity)

cameraAnchor = AnchorEntity(.camera)
Expand All @@ -290,9 +279,8 @@ open class FocusEntity: Entity, HasAnchoring, HasFocusEntity {
self.fillPlane = fillPlane
self.coloredStateChanged()
case .classic:
guard let classicStyle = self.focus.classicStyle else {
return
}
guard let classicStyle = self.focus.classicStyle
else { return }
self.setupClassic(classicStyle)
}
}
Expand All @@ -306,7 +294,6 @@ open class FocusEntity: Entity, HasAnchoring, HasFocusEntity {
/// Hides the focus square.
func hide() {
self.isEnabled = false
// runAction(.fadeOut(duration: 0.5), forKey: "hide")
}

/// Displays the focus square parallel to the camera plane.
Expand All @@ -320,7 +307,6 @@ open class FocusEntity: Entity, HasAnchoring, HasFocusEntity {

/// Places the focus entity in front of the camera instead of on a plane.
private func putInFrontOfCamera() {

// Works better than arView.ray()
let newPosition = cameraAnchor.convert(position: [0, 0, -1], to: nil)
recentFocusEntityPositions.append(newPosition)
Expand Down Expand Up @@ -375,9 +361,7 @@ open class FocusEntity: Entity, HasAnchoring, HasFocusEntity {
case .classic:
if self.onPlane {
self.onPlaneAnimation(newPlane: newPlane)
} else {
self.offPlaneAniation()
}
} else { self.offPlaneAniation() }
}
}

Expand Down

0 comments on commit 9d83ea6

Please sign in to comment.