From 2b37c963f2cec936002031d06732219fba39c17e Mon Sep 17 00:00:00 2001 From: jonaszmclaren Date: Tue, 15 Aug 2017 12:26:35 +0200 Subject: [PATCH 1/5] Update xcode.md Change order to make more sense. --- 2.0/docs/getting-started/xcode.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/2.0/docs/getting-started/xcode.md b/2.0/docs/getting-started/xcode.md index 82b6197a..c26dad71 100644 --- a/2.0/docs/getting-started/xcode.md +++ b/2.0/docs/getting-started/xcode.md @@ -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. - -select 'run' from dropdown - ## 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. + +select 'run' from dropdown + ### Manual To generate a new Xcode project manually. From 7a8ac97d49d6652550f822e187d3087224322a3b Mon Sep 17 00:00:00 2001 From: jonaszmclaren Date: Tue, 15 Aug 2017 12:28:31 +0200 Subject: [PATCH 2/5] Update droplet.md --- 2.0/docs/vapor/droplet.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2.0/docs/vapor/droplet.md b/2.0/docs/vapor/droplet.md index 4c6697dc..bc51bcc8 100644 --- a/2.0/docs/vapor/droplet.md +++ b/2.0/docs/vapor/droplet.md @@ -120,7 +120,7 @@ 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() + "!!!") } } ``` From aea36716c00b1d7a9ddcc1de8b1c70f9bba309db Mon Sep 17 00:00:00 2001 From: jonaszmclaren Date: Tue, 15 Aug 2017 12:52:05 +0200 Subject: [PATCH 3/5] Update droplet.md Fix AllCapsLogger creation to compile. --- 2.0/docs/vapor/droplet.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/2.0/docs/vapor/droplet.md b/2.0/docs/vapor/droplet.md index bc51bcc8..8c5b77d5 100644 --- a/2.0/docs/vapor/droplet.md +++ b/2.0/docs/vapor/droplet.md @@ -123,6 +123,12 @@ final class AllCapsLogger: LogProtocol { print(message.uppercased() + "!!!") } } + +extension AllCapsLogger: ConfigInitializable { + public convenience init(config: Config) throws { + self.init() + } +} ``` Now add the logger to the Droplet using the `addConfigurable` method for logs. @@ -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) From f254b53bdef9db4e0f7d17dd8ce0f2b9caa5ad4b Mon Sep 17 00:00:00 2001 From: jonaszmclaren Date: Tue, 15 Aug 2017 12:53:08 +0200 Subject: [PATCH 4/5] Update droplet.md Formatting fix --- 2.0/docs/vapor/droplet.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/2.0/docs/vapor/droplet.md b/2.0/docs/vapor/droplet.md index 8c5b77d5..78ccf901 100644 --- a/2.0/docs/vapor/droplet.md +++ b/2.0/docs/vapor/droplet.md @@ -125,9 +125,9 @@ final class AllCapsLogger: LogProtocol { } extension AllCapsLogger: ConfigInitializable { - public convenience init(config: Config) throws { - self.init() - } + public convenience init(config: Config) throws { + self.init() + } } ``` From bb613ad76717fbd47a73f9089215bcb5490f980f Mon Sep 17 00:00:00 2001 From: jonaszmclaren Date: Tue, 15 Aug 2017 13:07:11 +0200 Subject: [PATCH 5/5] Update droplet.md Further corrections. --- 2.0/docs/vapor/droplet.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/2.0/docs/vapor/droplet.md b/2.0/docs/vapor/droplet.md index 78ccf901..4cd498fd 100644 --- a/2.0/docs/vapor/droplet.md +++ b/2.0/docs/vapor/droplet.md @@ -125,7 +125,7 @@ final class AllCapsLogger: LogProtocol { } extension AllCapsLogger: ConfigInitializable { - public convenience init(config: Config) throws { + convenience init(config: Config) throws { self.init() } } @@ -172,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) } @@ -193,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)