JohnSundell / Files

A nicer way to handle files & folders in Swift
MIT License
2.53k stars 182 forks source link

Swift5 code styles #93

Closed maximkrouk closed 5 years ago

maximkrouk commented 5 years ago

Just tried to make code a little bit more swifty. Build should be failing because of swift5.1 I guess 💁‍♂️.

And what do you think about using

guard someLongExpressionHere
else { throw SomeErrorHere }

instead of

guard someLongExpressionHere else {
    throw SomeErrorHere 
}

The first one seems more laconic I think c: One-line short expressions as well:

// Examples:

// In operations
var isAsynchronous { true }
// Instead of:
var isAsynchronous { 
    return true
}

// In functions
users.map { $0.name } 
// Instead of:
users.map {
    $0.name 
} 
JohnSundell commented 5 years ago

@maximkrouk Thanks for contributing, but you haven't made the code more "Swifty", you've only made it conform to your own personal code style - which I'm not interested in. Plus, you've added a ton of unnecessary whitespace. Closing this.

maximkrouk commented 5 years ago

Well, got it, thanks for the feedback.

maximkrouk commented 5 years ago

Really nice feedback, for now it's my second contribution and I made the same mistake in the previous one, now I understand the point and will be more attentive and respective to the owner styles.

JohnSundell commented 5 years ago

That's great @maximkrouk! 🙌