[swift-users] Source code " : " guidelines

Kostiantyn Koval konstantin.koval1 at gmail.com
Sat Dec 5 13:00:35 CST 2015


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 <https://twitter.com/_jackhl/status/646723367576276992>
> 
> Stephen
> 
>> On Dec 5, 2015, at 1:43 PM, Paul Schifferer <paul at schifferers.net <mailto: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 <mailto: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 <mailto:swift-users at swift.org>
>>> https://lists.swift.org/mailman/listinfo/swift-users
>>  _______________________________________________
>> swift-users mailing list
>> swift-users at swift.org <mailto:swift-users at swift.org>
>> https://lists.swift.org/mailman/listinfo/swift-users <https://lists.swift.org/mailman/listinfo/swift-users>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20151205/d8b2ff0e/attachment.html>


More information about the swift-users mailing list