Skip to content

Commit 3bbfcd9

Browse files
committed
migrated code base to swift 2.0 syntax
1 parent c5961a8 commit 3bbfcd9

File tree

3 files changed

+26
-25
lines changed

3 files changed

+26
-25
lines changed

ManualLayout.xcodeproj/project.pbxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@
309309
5FB4CBE01A9BBE7500C2FB4F /* Project object */ = {
310310
isa = PBXProject;
311311
attributes = {
312+
LastSwiftUpdateCheck = 0700;
312313
LastUpgradeCheck = 0610;
313314
ORGANIZATIONNAME = "Baris Sencan";
314315
TargetAttributes = {

ManualLayout/HelperFunctions.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,49 +16,49 @@ internal func snapToPixel(pointCoordinate coordinate: CGFloat) -> CGFloat {
1616
//MARK: - Insetting
1717

1818
public func inset(view: UIView, amount: CGFloat) -> CGRect {
19-
return inset(view.frame, amount)
19+
return inset(view.frame, amount: amount)
2020
}
2121

2222
public func inset(layer: CALayer, amount: CGFloat) -> CGRect {
23-
return inset(layer.frame, amount)
23+
return inset(layer.frame, amount: amount)
2424
}
2525

2626
public func inset(rect: CGRect, amount: CGFloat) -> CGRect {
2727
return CGRectInset(rect, amount, amount)
2828
}
2929

3030
public func inset(view: UIView, dx: CGFloat, dy: CGFloat) -> CGRect {
31-
return inset(view.frame, dx, dy)
31+
return inset(view.frame, dx: dx, dy: dy)
3232
}
3333

3434
public func inset(layer: CALayer, dx: CGFloat, dy: CGFloat) -> CGRect {
35-
return inset(layer.frame, dx, dy)
35+
return inset(layer.frame, dx: dx, dy: dy)
3636
}
3737

3838
public func inset(rect: CGRect, dx: CGFloat, dy: CGFloat) -> CGRect {
3939
return CGRectInset(rect, dx, dy)
4040
}
4141

4242
public func inset(view: UIView, top: CGFloat, left: CGFloat, bottom: CGFloat, right: CGFloat) -> CGRect {
43-
return inset(view.frame, top, left, bottom, right)
43+
return inset(view.frame, top: top, left: left, bottom: bottom, right: right)
4444
}
4545

4646
public func inset(layer: CALayer, top: CGFloat, left: CGFloat, bottom: CGFloat, right: CGFloat) -> CGRect {
47-
return inset(layer.frame, top, left, bottom, right)
47+
return inset(layer.frame, top: top, left: left, bottom: bottom, right: right)
4848
}
4949

5050
public func inset(rect: CGRect, top: CGFloat, left: CGFloat, bottom: CGFloat, right: CGFloat) -> CGRect {
5151
return CGRect(
52-
origin: offset(rect.origin, left, top),
53-
size: inset(rect.size, top, left, bottom, right))
52+
origin: offset(rect.origin, dx: left, dy: top),
53+
size: inset(rect.size, top: top, left: left, bottom: bottom, right: right))
5454
}
5555

5656
public func inset(size: CGSize, amount: CGFloat) -> CGSize {
57-
return inset(size, amount, amount)
57+
return inset(size, dx: amount, dy: amount)
5858
}
5959

6060
public func inset(size: CGSize, dx: CGFloat, dy: CGFloat) -> CGSize {
61-
return inset(size, dy, dx, dy, dx)
61+
return inset(size, top: dy, left: dx, bottom: dy, right: dx)
6262
}
6363

6464
public func inset(size: CGSize, top: CGFloat, left: CGFloat, bottom: CGFloat, right: CGFloat) -> CGSize {
@@ -70,31 +70,31 @@ public func inset(size: CGSize, top: CGFloat, left: CGFloat, bottom: CGFloat, ri
7070
// MARK: - Offsetting
7171

7272
public func offset(view: UIView, amount: CGFloat) -> CGRect {
73-
return offset(view.frame, amount)
73+
return offset(view.frame, amount: amount)
7474
}
7575

7676
public func offset(layer: CALayer, amount: CGFloat) -> CGRect {
77-
return offset(layer.frame, amount)
77+
return offset(layer.frame, amount: amount)
7878
}
7979

8080
public func offset(rect: CGRect, amount: CGFloat) -> CGRect {
8181
return CGRectOffset(rect, amount, amount)
8282
}
8383

8484
public func offset(view: UIView, dx: CGFloat, dy: CGFloat) -> CGRect {
85-
return offset(view.frame, dx, dy)
85+
return offset(view.frame, dx: dx, dy: dy)
8686
}
8787

8888
public func offset(layer: CALayer, dx: CGFloat, dy: CGFloat) -> CGRect {
89-
return offset(layer.frame, dx, dy)
89+
return offset(layer.frame, dx: dx, dy: dy)
9090
}
9191

9292
public func offset(rect: CGRect, dx: CGFloat, dy: CGFloat) -> CGRect {
9393
return CGRectOffset(rect, dx, dy)
9494
}
9595

9696
public func offset(point: CGPoint, amount: CGFloat) -> CGPoint {
97-
return offset(point, amount, amount)
97+
return offset(point, dx: amount, dy: amount)
9898
}
9999

100100
public func offset(point: CGPoint, dx: CGFloat, dy: CGFloat) -> CGPoint {

ManualLayoutTests/HelperFunctionTests.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,79 +19,79 @@ class HelperFunctionTests: XCTestCase {
1919
}
2020

2121
func testInsetRectSingleArg() {
22-
view.frame = inset(view, 1)
22+
view.frame = inset(view, amount: 1)
2323
XCTAssertEqual(
2424
view.frame,
2525
CGRect(x: 2, y: 4, width: 4, height: 6),
2626
"insetting with amount should inset correctly")
2727
}
2828

2929
func testInsetRectTwoArg() {
30-
view.frame = inset(view, 1, 2)
30+
view.frame = inset(view, dx: 1, dy: 2)
3131
XCTAssertEqual(
3232
view.frame,
3333
CGRect(x: 2, y: 5, width: 4, height: 4),
3434
"insetting with dx and dy should inset correctly")
3535
}
3636

3737
func testInsetRectFourArg() {
38-
view.frame = inset(view, 1, 2, 3, 4)
38+
view.frame = inset(view, top: 1, left: 2, bottom: 3, right: 4)
3939
XCTAssertEqual(
4040
view.frame,
4141
CGRect(x: 3, y: 4, width: 0, height: 4),
4242
"insetting with four arguments should inset correctly")
4343
}
4444

4545
func testInsetSizeSingleArg() {
46-
let size = inset(view.frame.size, 1)
46+
let size = inset(view.frame.size, amount: 1)
4747
XCTAssertEqual(
4848
size,
4949
CGSize(width: 4, height: 6),
5050
"insetting size with amount should inset correctly")
5151
}
5252

5353
func testInsetSizeTwoArg() {
54-
let size = inset(view.frame.size, 1, 2)
54+
let size = inset(view.frame.size, dx: 1, dy: 2)
5555
XCTAssertEqual(
5656
size,
5757
CGSize(width: 4, height: 4),
5858
"insetting size with two arguments should inset correctly")
5959
}
6060

6161
func testInsetSizeFourArg() {
62-
let size = inset(view.frame.size, 1, 2, 3, 4)
62+
let size = inset(view.frame.size, top: 1, left: 2, bottom: 3, right: 4)
6363
XCTAssertEqual(
6464
size,
6565
CGSize(width: 0, height: 4),
6666
"insetting size with four arguments should inset correctly")
6767
}
6868

6969
func testOffsetSingleArg() {
70-
view.frame = offset(view, 1)
70+
view.frame = offset(view, amount: 1)
7171
XCTAssertEqual(
7272
view.frame,
7373
CGRect(x: 2, y: 4, width: 6, height: 8),
7474
"offsetting with amount should offset correctly")
7575
}
7676

7777
func testOffsetTwoArg() {
78-
view.frame = offset(view, 1, 2)
78+
view.frame = offset(view, dx: 1, dy: 2)
7979
XCTAssertEqual(
8080
view.frame,
8181
CGRect(x: 2, y: 5, width: 6, height: 8),
8282
"offsetting with dx and dy should offset correctly")
8383
}
8484

8585
func testOffsetPointSingleArg() {
86-
let origin = offset(view.frame.origin, 1)
86+
let origin = offset(view.frame.origin, amount: 1)
8787
XCTAssertEqual(
8888
origin,
8989
CGPoint(x: 2, y: 4),
9090
"offsetting origin with amount should offset correctly")
9191
}
9292

9393
func testOffsetPointTwoArg() {
94-
let origin = offset(view.frame.origin, 1, 2)
94+
let origin = offset(view.frame.origin, dx: 1, dy: 2)
9595
XCTAssertEqual(
9696
origin,
9797
CGPoint(x: 2, y: 5),

0 commit comments

Comments
 (0)