Skip to content

Commit

Permalink
Merge branch 'release/0.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernard Gatt committed Apr 2, 2017
2 parents 8198306 + 26299e1 commit d2fcf49
Show file tree
Hide file tree
Showing 15 changed files with 549 additions and 57 deletions.
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
language: objective-c

xcode_project: StyleKit.xcodeproj
xcode_scheme: StyleKit
osx_image: xcode8.3
xcode_sdk: macosx10.11

script:
- xcodebuild clean build test -project StyleKit.xcodeproj -scheme StyleKit -destination 'platform=iOS Simulator,name=iPhone 7,OS=10.3'
57 changes: 38 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
![alt text](https://i.imgur.com/IqDIU4q.png "StyleKit - A powerful & easy to use styling framework written in Swift")

[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![Build Status](https://travis-ci.org/146BC/StyleKit.svg?branch=develop)](https://travis-ci.org/146BC/StyleKit) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)

StyleKit is a microframework that enables you to style your applications using a simple JSON file. Behind the scenes, StyleKit uses [UIAppearance](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIAppearance_Protocol/) and some selector magic to apply the styles. You can also customize the parser for greater flexibility.


###How does it work?
### How does it work?

####Create a JSON file in the following format
#### Create a JSON file in the following format

```js
{
"@headingFont": "HelveticaNeue-Bold:30.0",
"UILabel": {
"font": "HelveticaNeue-Bold:30.0",
"font": "@headingFont",
"backgroundColor": "#000FFF"
},
"StyleKitDemo.SKView": {
Expand All @@ -30,7 +31,7 @@ StyleKit is a microframework that enables you to style your applications using a
"StyleKitDemo.SKNavigationBar": {
"titleTextAttributes": {
"NSColor": "#000FFF",
"NSFont": "HelveticaNeue-Bold:30.0"
"NSFont": "@headingFont"
}
},
"StyleKitDemo.SKTextField": {
Expand All @@ -39,7 +40,7 @@ StyleKit is a microframework that enables you to style your applications using a
}
}
```
####Load JSON file
#### Load JSON file

*AppDelegate.swift*

Expand All @@ -58,7 +59,7 @@ func application(_ application: UIApplication,
On application launch the JSON file will be loaded and the styles applied.


###The JSON file structure
### The JSON file structure

Each object inside the JSON file should contain the name of the UIView as a key and the object inside should either contain the properties/functions that need to be set/called or another UIView, this will give you the ability to apply styles on views when contained in other views, an example of this would be the following.

Expand All @@ -79,7 +80,25 @@ This would apply HelveticaNeue-Bold with size 20 to all the UIButtons except the

Custom classes must be namespaced by the name of the module they are contained in. e.g. `StyleKitDemo.SKTextField`

###Bring Your Own Parser
### Aliases

```js
{
"@mainFont": "HelveticaNeue-Bold:20.0",
"@primaryColor": "#000FFF",
"UIButton": {
"font": "@mainFont"
},
"MyApp.LoginView": {
"UIButton": {
"font": "HelveticaNeue-Light:25.0",
"titleColor:normal": "@primaryColor"
}
}
}
```

### Bring Your Own Parser

StyleKit's initialiser supports passing a custom parser which should conform to the `StyleParsable` protocol.

Expand Down Expand Up @@ -115,7 +134,7 @@ func application(_ application: UIApplication,
}
```

###Logging###
### Logging

By default, StyleKit will log any errors to the console. To customise the level of logging, you can pass a logLevel parameter as follows:

Expand All @@ -131,23 +150,23 @@ The levels of logging are:
* ```.none```


###How to install?
### How to install?

####Carthage
#### Carthage

#####Swift 2.2 & 2.3
##### Swift 2.2 & 2.3

```ogdl
github "146BC/StyleKit" ~> 0.4
```

#####Swift 3
##### Swift 3

```ogdl
github "146BC/StyleKit" ~> 0.5
github "146BC/StyleKit" ~> 0.6
```

####CocoaPods
#### CocoaPods

Add the 146BC Source

Expand All @@ -156,14 +175,14 @@ source 'https://github.com/146BC/Specs.git'
source 'https://github.com/CocoaPods/Specs.git'
```

#####Swift 2.2 & 2.3
##### Swift 2.2 & 2.3

```ruby
pod 'StyleKit', '~> 0.4'
```

#####Swift 3
##### Swift 3

```ruby
pod 'StyleKit', '~> 0.5'
```
pod 'StyleKit', '~> 0.6'
```
Loading

0 comments on commit d2fcf49

Please sign in to comment.