vapor/api-template

Suggestion - remove global methods

Closed this issue · 5 comments

I think we should stop using global methods in app.swift, boot.swift, configure.swift, and routes.swift as it goes against the Swift style guide. I suggest instead using static methods of a singleton, as one possible alternative.

0xTim commented

Have you got a link to that in the Swift style guide? In general I'd agree with you, but things may be different for a main.swift

jdmcd commented

Personally I would argue this case fits point three:

  1. When function syntax is part of the established domain notation

The domain being main.swift semantics. Just my two cents, though :)

I'm fine with main.swift having a global method. But the other files all add global methods as well that just really don't need to be global.

0xTim commented

Closing as this repo has been superseded by vapor/template