Skip to content

Commit 4d172b0

Browse files
committed
Fix swiftlint
1 parent 7dc4acb commit 4d172b0

File tree

12 files changed

+51
-51
lines changed

12 files changed

+51
-51
lines changed

‎ps4/peggleclone/Models/Bucket.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ class Bucket: PeggleObject {
1616
}
1717

1818
override func overlap(peggleObject: PeggleObject) -> Bool {
19-
return false
19+
false
2020
}
2121
}

‎ps4/peggleclone/Models/TriangleBlock.swift‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,15 @@ class TriangleBlock: PeggleObject {
141141
if temp < 0 {
142142
return ((sizeA >= 0 && sizeB >= 0 && sizeC >= 0) ||
143143
(tempA >= 0 && tempB >= 0 && tempC >= 0) ||
144-
(sizeA+tempA <= temp && sizeB+tempB <= temp && sizeC+tempC <= temp))
144+
(sizeA + tempA <= temp && sizeB + tempB <= temp && sizeC + tempC <= temp))
145145
}
146146
return ((sizeA <= 0 && sizeB <= 0 && sizeC <= 0) ||
147147
(tempA <= 0 && tempB <= 0 && tempC <= 0) ||
148-
(sizeA+tempA >= temp && sizeB+tempB >= temp && sizeC+tempC >= temp))
148+
(sizeA + tempA >= temp && sizeB + tempB >= temp && sizeC + tempC >= temp))
149149
}
150150

151151
func trianglesIntersect(_ triangleOne: TriangleBlock, _ triangleTwo: TriangleBlock) -> Bool {
152-
return !(cross(triangleOne, triangleTwo) ||
152+
!(cross(triangleOne, triangleTwo) ||
153153
cross(triangleTwo, triangleOne))
154154
}
155155

‎ps4/peggleclone/Persistance/LevelPersistance.swift‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ struct LevelPersistance: Codable {
1111
var id: UUID
1212
var name: String
1313
var normalPegPersistances: [PegPersistance] = []
14-
var spookyPegPersistances: [SpookyPegPersitance] = []
14+
var spookyPegPersistances: [SpookyPegPersistance] = []
1515
var kaboomPegPersistances: [KaboomPegPersistance] = []
1616
var trianglePegPersistances: [TrianglePegPersistance] = []
1717
var width: Double
@@ -30,7 +30,7 @@ struct LevelPersistance: Codable {
3030
if let kaboomPeg = peggleObject as? KaboomPeg {
3131
kaboomPegPersistances.append(KaboomPegPersistance(kaboomPeg))
3232
} else if let spookyPeg = peggleObject as? SpookyPeg {
33-
spookyPegPersistances.append(SpookyPegPersitance(spookyPeg))
33+
spookyPegPersistances.append(SpookyPegPersistance(spookyPeg))
3434
} else if let peg = peggleObject as? Peg {
3535
normalPegPersistances.append(PegPersistance(peg))
3636
} else if let triangle = peggleObject as? TriangleBlock {
@@ -45,8 +45,8 @@ struct LevelPersistance: Codable {
4545
let heightRatio = height / self.height
4646
for pegPersistance in normalPegPersistances {
4747
peggleObjects.append(Peg(id: pegPersistance.id,
48-
center: pegPersistance.center.convertToPoint(xScale: widthRatio, yScale: heightRatio),
49-
color: pegPersistance.color,
48+
center: pegPersistance.center.convertToPoint(xScale: widthRatio, yScale: heightRatio),
49+
color: pegPersistance.color,
5050
radius: pegPersistance.radius * widthRatio,
5151
minRadius: pegPersistance.minRadius * widthRatio,
5252
maxRadius: pegPersistance.maxRadius * widthRatio))

‎ps4/peggleclone/Persistance/SpookyPegPersistance.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import Foundation
99

10-
class SpookyPegPersitance: PegPersistance {
10+
class SpookyPegPersistance: PegPersistance {
1111
init(_ spookyPeg: SpookyPeg) {
1212
super.init(spookyPeg)
1313
self.shadow = spookyPeg.shadow

‎ps4/peggleclone/SLGameEngine/PowerUpHandler.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class PowerUpHandler {
6565

6666
if spookyBallsActivated > 0 && isOutOfScreen(peg: cannonBall, canvasDimensions: canvasDimension) {
6767
gameDisplayDelegate.didMove(peggleObject: cannonBall,
68-
newLocation: Point(xCoordinate: cannonBall.center.xCoordinate, yCoordinate: 0))
68+
newLocation: Point(xCoordinate: cannonBall.center.xCoordinate, yCoordinate: 0))
6969
cannonBallPhysicsBody.moveTo(position: Point(xCoordinate: cannonBall.center.xCoordinate, yCoordinate: 0))
7070
cannonBallPhysicsBody
7171
.setVelocity(newVelocity: cannonBallPhysicsBody.velocity.multiplyWithScalar(scalar: 0.5))

‎ps4/peggleclone/SLGameEngine/SLGameEngine.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class SLGameEngine {
9595
}
9696

9797
func toPoint(point: CGPoint) -> Point {
98-
return Point(xCoordinate: point.x, yCoordinate: point.y)
98+
Point(xCoordinate: point.x, yCoordinate: point.y)
9999
}
100100

101101
func createDisplayLink() {

‎ps4/peggleclone/SLPhysicsEngine/SLPhysicsBucket.swift‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ import Foundation
99

1010
class SLPhysicsBucket: SLPhysicsBody {
1111
var mass: Double = 0.0
12-
var velocity: Vector = Vector(xDirection: 100, yDirection: 0)
12+
var velocity = Vector(xDirection: 100, yDirection: 0)
1313
var position: Point
14-
var gravity: Vector = Vector()
15-
var isDynamic: Bool = true
14+
var gravity = Vector()
15+
var isDynamic = true
1616
var forces: [Vector] = []
1717
var collisionsWith: [SLPhysicsBody] = []
1818
var height: Double
1919
var width: Double
20-
var hasCollided: Bool = false
21-
var canIgnore: Bool = false
20+
var hasCollided = false
21+
var canIgnore = false
2222
var previousPosition: Point
2323

2424
init(position: Point, height: Double, width: Double) {

‎ps4/peggleclone/SLPhysicsEngine/SLPhysicsTriangle.swift‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class SLPhysicsTriangle: SLPhysicsBody {
3434
self.position = position
3535
self.gravity = gravity
3636
self.isDynamic = isDynamic
37-
self.mass = 1/2 * height * width
37+
self.mass = 1 / 2 * height * width
3838
self.height = height
3939
self.width = width
4040
self.vertexOne = Point(xCoordinate: position.xCoordinate,
@@ -51,7 +51,7 @@ class SLPhysicsTriangle: SLPhysicsBody {
5151
self.position = position
5252
self.gravity = Vector(xDirection: 0, yDirection: 9.81)
5353
self.isDynamic = isDynamic
54-
self.mass = 1/2 * height * width
54+
self.mass = 1 / 2 * height * width
5555
self.height = height
5656
self.width = width
5757
self.vertexOne = Point(xCoordinate: position.xCoordinate,

‎ps4/peggleclone/SLPhysicsEngine/SLPhysicsWorld.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class SLPhysicsWorld {
7878
currentBody.setCollided()
7979
nextBody.setCollided()
8080
collisions.append(SLPhysicsCollision(firstBody: currentBody,
81-
secondBody: nextBody))
81+
secondBody: nextBody))
8282
currentBody.addCollisionWith(physicsBody: nextBody)
8383
nextBody.addCollisionWith(physicsBody: currentBody)
8484
// MusicManager.shared.ballBounceMusic()

‎ps4/peggleclone/Views/LevelDesigner/LevelDesignerCanvasView.swift‎

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -49,35 +49,35 @@ struct LevelDesignerCanvasView: View {
4949
} else if let triangle = peggleObject as? TriangleBlock {
5050
return AnyView(
5151
ZStack {
52-
TriangleView(location: .constant(CGPoint(x: triangle.center.xCoordinate,
53-
y: triangle.center.yCoordinate)),
54-
triangleBase: triangle.base,
55-
triangleHeight: triangle.height)
56-
.onTapGesture {
57-
if keyboardResponder.currentHeight == 0 && levelManager.isDeleteSelected {
58-
levelManager.delete(peggleObject: triangle)
59-
}
60-
}
61-
.onLongPressGesture(minimumDuration: 1.5) {
62-
if keyboardResponder.currentHeight == 0 {
63-
levelManager.delete(peggleObject: triangle)
52+
TriangleView(location: .constant(CGPoint(x: triangle.center.xCoordinate,
53+
y: triangle.center.yCoordinate)),
54+
triangleBase: triangle.base,
55+
triangleHeight: triangle.height)
56+
.onTapGesture {
57+
if keyboardResponder.currentHeight == 0 && levelManager.isDeleteSelected {
58+
levelManager.delete(peggleObject: triangle)
59+
}
6460
}
65-
}
66-
.gesture(DragGesture().onChanged({ value in
67-
if keyboardResponder.currentHeight == 0 {
68-
if isResize {
69-
let locationOfFinger = value.location
70-
levelManager.resizeObject(peggleObject: triangle,
71-
location: locationOfFinger,
72-
canvasDimensions: canvasDimensions)
73-
} else {
74-
let locationOfTriangle = value.location
75-
levelManager.dragObject(peggleObject: triangle,
76-
newLocation: locationOfTriangle,
77-
canvasDimensions: canvasDimensions)
61+
.onLongPressGesture(minimumDuration: 1.5) {
62+
if keyboardResponder.currentHeight == 0 {
63+
levelManager.delete(peggleObject: triangle)
7864
}
7965
}
80-
}))
66+
.gesture(DragGesture().onChanged({ value in
67+
if keyboardResponder.currentHeight == 0 {
68+
if isResize {
69+
let locationOfFinger = value.location
70+
levelManager.resizeObject(peggleObject: triangle,
71+
location: locationOfFinger,
72+
canvasDimensions: canvasDimensions)
73+
} else {
74+
let locationOfTriangle = value.location
75+
levelManager.dragObject(peggleObject: triangle,
76+
newLocation: locationOfTriangle,
77+
canvasDimensions: canvasDimensions)
78+
}
79+
}
80+
}))
8181
})
8282
} else {
8383
return AnyView(EmptyView())

0 commit comments

Comments
 (0)