-
Notifications
You must be signed in to change notification settings - Fork 47
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
Update README and add logo #3
Changes from 6 commits
a15c7c9
da6e986
d72cfb1
a227df8
05ab42b
02d262c
7b2fdf0
fad6d5a
88119a0
0ffdaca
29b1cb5
1fa4ebb
6ea0eac
adfc7cc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,67 @@ | ||
# Compass | ||
![Compass logo](https://raw.githubusercontent.com/hyperoslo/Compass/update/readme/Images/logo_v1.png) | ||
|
||
[![CI Status](http://img.shields.io/travis/hyperoslo/Compass.svg?style=flat)](https://travis-ci.org/hyperoslo/Compass) | ||
[![Version](https://img.shields.io/cocoapods/v/Compass.svg?style=flat)](http://cocoadocs.org/docsets/Compass) | ||
[![License](https://img.shields.io/cocoapods/l/Compass.svg?style=flat)](http://cocoadocs.org/docsets/Compass) | ||
[![Platform](https://img.shields.io/cocoapods/p/Compass.svg?style=flat)](http://cocoadocs.org/docsets/Compass) | ||
|
||
## Usage | ||
Compass helps you setup a central navigation system for your application. | ||
This has many benefits, one of them being that controllers can now be | ||
decoupled, meaning that the list that presents the detail no longer knows | ||
about what its presenting. Controllers become agnostic and view stay | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. view -> views? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
stupid. The user experience stays the same but the logic and separation of | ||
concerns become clearer. The outcome is that your application will become | ||
more modular by default. Anything could potentially be displayed from | ||
anywhere but do tread safe, with great power comes great responsibility. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should there be a comma or something, cause I didn't get "but do tread safe". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated the sentence, better now? |
||
|
||
## Setup | ||
|
||
#### Step 1 | ||
First you need to register a URL scheme for your application | ||
<img src="https://raw.githubusercontent.com/hyperoslo/Compass/update/readme/Images/setup-url-scheme.png"> | ||
|
||
#### Step 2 | ||
Now you need to configure Compass to use that URL scheme, a good place | ||
to do this is in your `AppDelegate` | ||
```swift | ||
func application(application: UIApplication, | ||
didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { | ||
Compass.scheme = "compass" | ||
return true | ||
} | ||
``` | ||
#### Step 3 | ||
Configure your application routes | ||
```swift | ||
func application(application: UIApplication, | ||
didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { | ||
Compass.scheme = "compass" | ||
Compass.routes = ["profile:{username}", "login:{username}", "logout"] | ||
return true | ||
} | ||
``` | ||
#### Step 4 | ||
Setup your application to response to the URLs, this can be done in the `AppDelegate` but its up to you to find a more suitable place for it depending on the size of your implementation. | ||
```swift | ||
<API> | ||
func application(app: UIApplication, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we have to mention that this func should be used to open a view from outside, but for internal usage it's better to have some global/static function, not to invoke |
||
openURL url: NSURL, | ||
options: [String : AnyObject]) -> Bool { | ||
return Compass.parse(url) { route, arguments in | ||
switch route { | ||
case "profile:{username}": | ||
let profileController = profileController(title: arguments["{username}"]) | ||
self.navigationController?.pushViewController(profileController, | ||
animated: true) | ||
case "login:{username}": | ||
let loginController = LoginController(title: arguments["{username}"]) | ||
self.navigationController?.pushViewController(loginController, | ||
animated: true) | ||
case "logout": | ||
logout() | ||
default: break | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Installation | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's better to say that you could present any controller from any place in your app. The list and detail are just a specific example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, you already have a line about that below 😄