Hi everyone!
While learning and in pursuit a to more idiomatic Swift, I put together a playground where I’ve been experimenting with some simple sorting techniques.
I’d appreciate any ideas on how to improve those algorithms into a more Swift-y form.
So, here is the repository <https://github.com/adrfer/Sort>\.
Best,
— A
Hi everyone!
Jus wondering what is more idiomatic in Swift?
guard !array.isEmpty else {
return false
}
or
if array.isEmpty {
return false
}
What about when it comes to indentation style?
if array.isEmpty {
return false
}
Or is there an exception of simple one-liners? Is it still 1TBS <Indentation style - Wikipedia?
if array.isEmpty { return false }
Both styles are present in Apple’s Swifts projects on GitHub.
Best,
— A
···
On Dec 21, 2015, at 11:01 PM, Adriano Ferreira via swift-users <swift-users@swift.org> wrote:
Hi everyone!
While learning and in pursuit a to more idiomatic Swift, I put together a playground where I’ve been experimenting with some simple sorting techniques.
I’d appreciate any ideas on how to improve those algorithms into a more Swift-y form.
So, here is the repository <https://github.com/adrfer/Sort>\.
Best,
— A
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users
Funny you should ask:
Migrating `if`s to `guard`s in Swift <http://ericasadun.com/2015/12/29/migrating-ifs-to-guards-in-swift/>
Why Swift guard Should Be Avoided | by Alexey Kuznetsov | Swift Programming | Medium
Another take on guard <http://ericasadun.com/2016/01/01/another-take-on-guard/>
···
On Jan 4, 2016, at 11:18 AM, Adriano Ferreira via swift-users <swift-users@swift.org> wrote:
Hi everyone!
Jus wondering what is more idiomatic in Swift?
guard !array.isEmpty else {
return false
}
or
if array.isEmpty {
return false
}
What about when it comes to indentation style?
if array.isEmpty {
return false
}
Or is there an exception of simple one-liners? Is it still 1TBS <Indentation style - Wikipedia?
if array.isEmpty { return false }
Both styles are present in Apple’s Swifts projects on GitHub.
Best,
— A
On Dec 21, 2015, at 11:01 PM, Adriano Ferreira via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:
Hi everyone!
While learning and in pursuit a to more idiomatic Swift, I put together a playground where I’ve been experimenting with some simple sorting techniques.
I’d appreciate any ideas on how to improve those algorithms into a more Swift-y form.
So, here is the repository <https://github.com/adrfer/Sort>\.
Best,
— A
_______________________________________________
swift-users mailing list
swift-users@swift.org <mailto:swift-users@swift.org>
https://lists.swift.org/mailman/listinfo/swift-users
_______________________________________________
swift-users mailing list
swift-users@swift.org <mailto:swift-users@swift.org>
https://lists.swift.org/mailman/listinfo/swift-users