Merge pull request #209 from jonaszmclaren/master

Small corrections in xcode.md and droplet.md
This commit is contained in:
Tanner 2017-08-23 15:38:58 -04:00 committed by GitHub
commit 271e3d3f4f
2 changed files with 17 additions and 11 deletions

View File

@ -8,12 +8,6 @@ You can build, run, and stop your server from within Xcode, as well as use break
To use Xcode, you will first need to generate a `*.xcodeproj` file.
### Select 'Run'
Make sure after generating your Xcode project that you properly select the executable if you're trying to run your application.
<img src="https://cloud.githubusercontent.com/assets/6710841/26517851/72841fd6-426f-11e7-9e6c-945d22933094.png" alt="select 'run' from dropdown" width="300">
## Generate Project
### Vapor Toolbox
@ -27,6 +21,12 @@ vapor xcode
!!! tip
If you'd like to automatically open the Xcode project, use `vapor xcode -y`
### Select 'Run'
Make sure after generating your Xcode project that you properly select the executable if you're trying to run your application.
<img src="https://cloud.githubusercontent.com/assets/6710841/26517851/72841fd6-426f-11e7-9e6c-945d22933094.png" alt="select 'run' from dropdown" width="300">
### Manual
To generate a new Xcode project manually.

View File

@ -120,7 +120,13 @@ Let's create a custom logger to demonstrate Vapor's configurable properties.
final class AllCapsLogger: LogProtocol {
var enabled: [LogLevel] = []
func log(_ level: LogLevel, message: String, file: String, function: String, line: Int) {
print(message.uppercased + "!!!")
print(message.uppercased() + "!!!")
}
}
extension AllCapsLogger: ConfigInitializable {
convenience init(config: Config) throws {
self.init()
}
}
```
@ -130,7 +136,7 @@ Now add the logger to the Droplet using the `addConfigurable` method for logs.
`main.swift`
```swift
let config = try Config()
config.addConfigurable(log: AllCapsLogger(), name: "all-caps")
config.addConfigurable(log: AllCapsLogger.init, name: "all-caps")
let drop = try Droplet(config)
@ -166,12 +172,12 @@ final class AllCapsLogger: LogProtocol {
}
func log(_ level: LogLevel, message: String, file: String, function: String, line: Int) {
print(message.uppercased + String(repeating: "!", count: exclamationCount))
print(message.uppercased() + String(repeating: "!", count: exclamationCount))
}
}
extension AllCapsLogger: ConfigInitializable {
init(config: Config) throws {
convenience init(config: Config) throws {
let count = config["allCaps", "exclamationCount"]?.int ?? 3
self.init(exclamationCount: count)
}
@ -187,7 +193,7 @@ Now that we have conformed our logger to `ConfigInitializable`, we can pass just
`main.swift`
```swift
let config = try Config()
config.addConfigurable(log: AllCapsLogger.self, name: "all-caps")
config.addConfigurable(log: AllCapsLogger.init, name: "all-caps")
let drop = try Droplet(config)