Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/refactor #80

Merged
merged 6 commits into from
Jul 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 3 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,36 +114,6 @@ Currently support

### iOS Extensions

#### UICollectionView

##### +Indexes

```swift
let collectionView = UICollectionView()
collectionView.insert([1,2,3]) // ([Int] -> [NSIndexPaths]).{ insertRowsAtIndexPaths }
collectionView.reload([1,2,3]) // ([Int] -> [NSIndexPaths]).{ reloadRowsAtIndexPaths }
collectionView.delete([1,2,3]) // ([Int] -> [NSIndexPaths]).{ deleteRowsAtIndexPaths }
collectionView.reloadSection() // ([Int] -> [NSIndexSet]).{ reloadSections }
```

Enables you to easily run insert, update, delete, reload methods for a collection view by using `Int`s instead
of `NSIndexPath` and `NSIndexSet`.

#### UITableView

##### +Indexes

```swift
let tableView = UITableView()
tableView.insert([1,2,3]) // ([Int] -> [NSIndexPaths]).{ insertRowsAtIndexPaths }
tableView.reload([1,2,3]) // ([Int] -> [NSIndexPaths]).{ reloadRowsAtIndexPaths }
tableView.delete([1,2,3]) // ([Int] -> [NSIndexPaths]).{ deleteRowsAtIndexPaths }
tableView.reloadSection() // ([Int] -> [NSIndexSet]).{ reloadSections }
```

Enables you to easily run insert, update, delete, reload methods for a table view by using `Int`s instead
of `NSIndexPath` and `NSIndexSet`.

#### UIView

##### .optimize()
Expand All @@ -165,24 +135,14 @@ image.original // imageWithRenderingMode(.AlwaysOriginal)
image.template // imageWithRenderingMode(.AlwaysTemplate)
```

## OS X

### OS X Extensions

#### NSTableView
## Shared

##### +Indexes
### SequenceType

```swift
let tableView = NSTableView()
tableView.insert([1,2,3]) // ([Int] -> [NSIndexPaths]).{ insertRowsAtIndexPaths }
tableView.reload([1,2,3]) // ([Int] -> [NSIndexPaths]).{ reloadRowsAtIndexPaths }
tableView.delete([1,2,3]) // ([Int] -> [NSIndexPaths]).{ deleteRowsAtIndexPaths }
tableView.reloadSection() // ([Int] -> [NSIndexSet]).{ reloadSections }
let first: Int? = items.findFirst({ $0 > 10 })
```

## Shared

### Dates

#### Compare
Expand Down
33 changes: 0 additions & 33 deletions Source/Mac/Extensions/NSTableView+Indexes.swift

This file was deleted.

14 changes: 14 additions & 0 deletions Source/Shared/Extensions/SequenceType+Extensions.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import Foundation

public extension SequenceType {

public func findFirst(@noescape predicate: (Self.Generator.Element) -> Bool) -> Self.Generator.Element? {
for element in self {
if predicate(element) {
return element
}
}

return nil
}
}
10 changes: 10 additions & 0 deletions Source/Shared/Extensions/String+CoreFoundation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,14 @@ public extension String {
func trim() -> String {
return stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceCharacterSet())
}

var uppercaseFirstLetter: String {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this the same as capitalizedString?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vadymmarkov ah, it's just the first letter that will be uppercase

Copy link
Contributor

@zenangst zenangst Jul 2, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

capitalizedString

A string with the first character in each word changed to its corresponding uppercase value, and all remaining characters set to their corresponding lowercase values.

guard isPresent else { return self }

var string = self
string.replaceRange(string.startIndex...string.startIndex,
with: String(string[string.startIndex]).capitalizedString)

return string
}
}
44 changes: 0 additions & 44 deletions Source/iOS/Extensions/UICollectionView+Indexes.swift

This file was deleted.

40 changes: 0 additions & 40 deletions Source/iOS/Extensions/UITableView+Indexes.swift

This file was deleted.

Loading