Skip to content

Commit eda2b55

Browse files
committed
Update README.md
1 parent 3848ed5 commit eda2b55

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,56 @@ Cocoapod of useful extensions written in Swift 2.2.
44
##Example Extension Usage
55

66
```swift
7+
/// Value Type Extensions
78
var str = "Hello, playground"
89

10+
str.subscript(range) // returns substring of range
11+
12+
str.subscript(index) // returns character at index
13+
914
str.toUnicodeArray() // [72, 101, 108, 108, 111, 44, 32, 112, 108, 97, 121, 103, 114, 111, 117, 110, 100]
1015

1116
str.toUnicodeArray()[0].toChar() // "H"
1217

1318
str.toUnicodeArray().toString() // "Hello, playground"
19+
20+
str.length() // 17
21+
22+
var int: Int = 0
23+
24+
int.add(2) // 2
25+
26+
/// UITableView Extensions
27+
var tableView: UITableView
28+
29+
tableView.animateData() // reloads data and animates load
30+
tableView.animateData(1.0, delayOffset: 0.05, usingSpringWithDamping: 0.75, initialSpringVelocity: 0) // reloads data and animates
31+
32+
/// UIView Extensions
33+
IBInspectable for cornerRadius
34+
35+
/// Delay Extension
36+
var object: NSObject
37+
38+
object.delay(2) {
39+
// do something after 2 seconds
40+
}
41+
42+
delay(2) {
43+
// do something after 2 seconds
44+
}
45+
46+
/// Binary Search Extensions (all use throws)
47+
func binarySearch(collection: [T], query: T) throws -> Bool
48+
func binarySearchPrefix(collection: [String], query: String) throws -> Bool
49+
func binarySearchFirst(collection: [String], query: String) throws -> Int
50+
func binarySearchLast(collection: [String], query: String) throws -> Int
51+
52+
/// Array2D Struct
53+
Array2D(columns: Int, rows: Int)
54+
Array2D.subscript(column: Int, row: Int) -> Int
55+
Array2D.columnCount()
56+
Array2D.rowCount()
1457
```
1558

1659
##CocoaPods

0 commit comments

Comments
 (0)