[swift-users] Source code " : " guidelines

Roshan thisisroshansmail at gmail.com
Sat Dec 5 14:09:34 CST 2015


To me, no space to the left makes more sense. It conveys a sense of
belonging that is similar to variable declarations.

extension Deck: Equatable indicates that the Deck class is Equatable in the
same way var a: Int indicates that a is Int...

On Sun, Dec 6, 2015 at 12:30 AM, Kostiantyn Koval <
konstantin.koval1 at gmail.com> wrote:

> This is code from  https://github.com/apple/swift-package-manager
> public enum Error: ErrorType {
> }
>
> extension Package : Equatable {
> }
>
> I see that in most palaces Apple prefer not having the space on the left
> side.
> But it wan't sure if it's ok to make a PR for that :)
>
>
> Best Regards,
> Kostiantyn
>
> On 05 Dec 2015, at 19:48, Stephen Celis <stephen.celis at gmail.com> wrote:
>
> I believe Apple style prefers no space to the left:
>
> https://twitter.com/_jackhl/status/646723367576276992
>
> Stephen
>
> On Dec 5, 2015, at 1:43 PM, Paul Schifferer <paul at schifferers.net> wrote:
>
> My personal preference is to put a space on both sides of the colon when
> it’s used for declaration or extension:
>
> class SomeClass : SomeProtocol {
>   var name : String
> }
>
> and a space only after it’s used for providing a value (as in a function
> parameter):
>
> object.callSomething(value: v)
>
> --
> Paul
>
> On December 5, 2015 at 10:24:40, Kostiantyn Koval (
> konstantin.koval1 at gmail.com) wrote:
>
> Hi Swift team,
>
> Is there a perfect style for ":" when declaring a Type?
> I have seen 2 styles in Swift source code.
>
> extension Deck : Equatable
> extension Deck: Equatable
>
> Is there any guideline for it or both are acceptable?
>
> Best Regards,
> Kostiantyn
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>
>  _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>
>
>
>
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>
>


-- 
Warm regards
Roshan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20151206/0fb458ea/attachment.html>


More information about the swift-users mailing list