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

Update README and add logo #3

Merged
merged 14 commits into from
Nov 11, 2015
Merged
Show file tree
Hide file tree
Changes from 6 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
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
770C3CD094BF3A3377FCD018 /* Pods.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 444C742BF0B07D34601BB603 /* Pods.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
770C3CD094BF3A3377FCD018 /* Pods.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 444C742BF0B07D34601BB603 /* Pods.framework */; };
BD6929321BC51DC40063E97E /* LoginController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD6929311BC51DC40063E97E /* LoginController.swift */; settings = {ASSET_TAGS = (); }; };
BD93421A1BC4FFCA00F25395 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD9342191BC4FFCA00F25395 /* AppDelegate.swift */; };
BD93421C1BC4FFCA00F25395 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD93421B1BC4FFCA00F25395 /* ViewController.swift */; };
Expand Down
2 changes: 1 addition & 1 deletion Example/CompassExample/CompassExample/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>no.hyper.CompassExample</string>
<string>no.hyper.Compass</string>
<key>CFBundleURLSchemes</key>
<array>
<string>compass</string>
Expand Down
2 changes: 1 addition & 1 deletion Example/CompassExample/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
Compass: e01188a61ec071d122ca607202a21eb9b52ea0b9

COCOAPODS: 0.39.0.beta.4
COCOAPODS: 0.39.0
Binary file added Images/logo_v1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/setup-url-scheme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 56 additions & 3 deletions README.md
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
Copy link
Contributor

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.

Copy link
Contributor

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 😄

about what its presenting. Controllers become agnostic and view stay
Copy link
Contributor

Choose a reason for hiding this comment

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

view -> views?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.
Copy link
Contributor

Choose a reason for hiding this comment

The 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".

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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,
Copy link
Contributor

Choose a reason for hiding this comment

The 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 applicationDidBecomeActive every time.

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
Expand Down