Skip to content

Commit

Permalink
Add colors to documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mac-cain13 committed Mar 16, 2016
1 parent d189242 commit 2a60287
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 28 deletions.
66 changes: 40 additions & 26 deletions Documentation/Examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,46 @@ let settingsIcon = R.image.settingsIcon()
let gradientBackground = R.image.gradientJpg()
```

## Custom fonts

*Vanilla*
```swift
let lightFontTitle = UIFont(name: "Acme-Light", size: 22)
```

*With R.swift*
```swift
let lightFontTitle = R.font.acmeLight(size: 22)
```

## Resource files

*Vanilla*
```swift
let jsonURL = NSBundle.mainBundle().URLForResource("seed-data", withExtension: "json")
let jsonPath = NSBundle.mainBundle().pathForResource("seed-data", withExtension: "json")
```

*With R.swift*
```swift
let jsonURL = R.file.seedDataJson()
let jsonPath = R.file.seedDataJson.path()
```

## Colors

*Vanilla*
```swift
label.backgroundColor = UIColor(red: 0.9, green: 0.9, blue: 0.9, alpha: 0.5)
label.textColor = UIColor(red: 0.3, green: 0.3, blue: 0.3, alpha: 1.0)
```

*With R.swift*
```swift
label.backgroundColor = R.color.appColors.backgroundColor()
label.textColor = R.color.appColors.textColor()
```

## Storyboards

*Vanilla*
Expand Down Expand Up @@ -169,29 +209,3 @@ class RecentsController: UICollectionViewController {
}
}
```

## Custom fonts

*Vanilla*
```swift
let lightFontTitle = UIFont(name: "Acme-Light", size: 22)
```

*With R.swift*
```swift
let lightFontTitle = R.font.acmeLight(size: 22)
```

## Resource files

*Vanilla*
```swift
let jsonURL = NSBundle.mainBundle().URLForResource("seed-data", withExtension: "json")
let jsonPath = NSBundle.mainBundle().pathForResource("seed-data", withExtension: "json")
```

*With R.swift*
```swift
let jsonURL = R.file.seedDataJson()
let jsonPath = R.file.seedDataJson.path()
```
5 changes: 3 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@ After installing R.swift into your project you can use the `R`-struct to access

R.swift currently supports these types of resources:
- [Images](Documentation/Examples.md#images)
- [Custom fonts](Documentation/Examples.md#custom-fonts)
- [Resource files](Documentation/Examples.md#resource-files)
- [Colors](Documentation/Examples.md#colors)
- [Storyboards](Documentation/Examples.md#storyboards)
- [Segues](Documentation/Examples.md#segues)
- [Nibs](Documentation/Examples.md#nibs)
- [Reusable cells](Documentation/Examples.md#reusable-cells)
- [Custom fonts](Documentation/Examples.md#custom-fonts)
- [Resource files](Documentation/Examples.md#resource-files)

Runtime validation with [`R.assertValid()`](Documentation/Examples.md#runtime-validation):
- If all images used in storyboards are available
Expand Down

0 comments on commit 2a60287

Please sign in to comment.