Skip to content

Commit 344b42d

Browse files
authored
Merge pull request #8 from devxoul/swift-3.0
Let's Swift 3.0
2 parents d50b0ee + 52a8064 commit 344b42d

File tree

15 files changed

+613
-562
lines changed

15 files changed

+613
-562
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ DerivedData
1414
*.hmap
1515
*.ipa
1616
*.xcuserstate
17-
17+
.DS_Store

.swift-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.0

README.md

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
SwiftyImage
22
===========
33

4-
![Swift 2.0](https://img.shields.io/badge/Swift-2.0-orange.svg)
4+
![Swift 2.0](https://img.shields.io/badge/Swift-3.0-orange.svg)
55
[![CocoaPods](http://img.shields.io/cocoapods/v/SwiftyImage.svg?style=flat)](https://cocoapods.org/pods/SwiftyImage)
66

77
The most sexy way to use images in Swift.
@@ -24,23 +24,23 @@ At a Glance
2424

2525
```swift
2626
UIImage.size(width: 100, height: 100)
27-
.color(UIColor.whiteColor())
28-
.border(color: UIColor.redColor())
29-
.border(width: 10)
30-
.corner(radius: 20)
31-
.image()
27+
.color(UIColor.whiteColor())
28+
.border(color: UIColor.redColor())
29+
.border(width: 10)
30+
.corner(radius: 20)
31+
.image
3232
```
3333

3434
![sample1](https://cloud.githubusercontent.com/assets/931655/8675848/106e59ea-2a81-11e5-8e4f-98cfea38bd8e.png)
3535

3636

3737
```swift
3838
UIImage.resizable()
39-
.color(UIColor.whiteColor())
40-
.border(color: UIColor.blueColor())
41-
.border(width: 5)
42-
.corner(radius: 10)
43-
.image()
39+
.color(UIColor.whiteColor())
40+
.border(color: UIColor.blueColor())
41+
.border(width: 5)
42+
.corner(radius: 10)
43+
.image
4444
```
4545

4646
![sample2](https://cloud.githubusercontent.com/assets/931655/8675936/514b7f60-2a81-11e5-8806-26036d8e8ba5.png)
@@ -74,33 +74,33 @@ UIImage.resizable() // ...
7474
You can set fill color, border attributes, corner radius, etc.
7575

7676
```swift
77-
UIImage.size(width: 100, height: 100) // fixed size
78-
.color(UIColor.whiteColor()) // fill color
79-
.border(color: UIColor.redColor()) // border color
80-
.border(width: 10) // border width
81-
.corner(radius: 20) // corner radius
77+
UIImage.size(width: 100, height: 100) // fixed size
78+
.color(UIColor.whiteColor()) // fill color
79+
.border(color: UIColor.redColor()) // border color
80+
.border(width: 10) // border width
81+
.corner(radius: 20) // corner radius
8282
```
8383

8484
```swift
8585
UIImage.resizable() // resizable image
86-
.color(UIColor.whiteColor())
87-
.border(color: UIColor.lightGrayColor())
88-
.border(width: 1)
89-
.corner(radius: 5)
86+
.color(UIColor.whiteColor())
87+
.border(color: UIColor.lightGrayColor())
88+
.border(width: 1)
89+
.corner(radius: 5)
9090
```
9191

9292

9393
#### Step 3. Generating Image
9494

95-
Use `.image()` at the end of method chaining to generate image.
95+
Use `.image` at the end of method chaining to generate image.
9696

9797
```swift
9898
imageView.image = UIImage.size(width: 100, height: 100)
99-
.color(UIColor.whiteColor())
100-
.border(color: UIColor.redColor())
101-
.border(width: 10)
102-
.corner(radius: 20)
103-
.image() // generate UIImage
99+
.color(UIColor.whiteColor())
100+
.border(color: UIColor.redColor())
101+
.border(width: 10)
102+
.corner(radius: 20)
103+
.image // generate UIImage
104104
```
105105

106106

@@ -127,7 +127,7 @@ imageView.image = UIImage.size(width: 100, height: 100)
127127

128128
| Generating Image Method | Description |
129129
|---|---|
130-
| `.image()` | Generate and return image |
130+
| `.image` | Generate and return image |
131131

132132

133133
Play with CGContext
@@ -139,8 +139,8 @@ SwiftyImage also provides a simple method to create or manipulate images with CG
139139

140140
```swift
141141
let image = UIImage.with(size: CGSize(width: 100, height: 100)) { context in
142-
UIColor.lightGrayColor().setFill()
143-
CGContextFillEllipseInRect(context, CGRect(x: 0, y: 0, width: 100, height: 100))
142+
UIColor.lightGrayColor().setFill()
143+
CGContextFillEllipseInRect(context, CGRect(x: 0, y: 0, width: 100, height: 100))
144144
}
145145
```
146146

@@ -149,8 +149,8 @@ let image = UIImage.with(size: CGSize(width: 100, height: 100)) { context in
149149

150150
```swift
151151
let newImage = oldImage.with { context in
152-
UIColor.lightGrayColor().setFill()
153-
CGContextFillEllipseInRect(context, CGRect(x: 0, y: 0, width: 100, height: 100))
152+
UIColor.lightGrayColor().setFill()
153+
CGContextFillEllipseInRect(context, CGRect(x: 0, y: 0, width: 100, height: 100))
154154
}
155155
```
156156

0 commit comments

Comments
 (0)