In the playground:

    "works?".capitalizedString // error: value of type 'String' has no member 
'capitalizedString'

… but:

    import Foundation
    “works!”.capitalizedString // “Works!” 

Would it not be nice if all the following likewise worked:

    import Foundation
    
    (1..<4).sample
    [1,2,3].sample
    "abc".characters.sample
    ["a": 1, "b": 2, "c": 3].sample

Like so many users of Swift, I have extensions 
<http://stackoverflow.com/a/30285125/1409907> of IntegerType, ClosedInterval 
and CollectionType that avail me of the above methods and their family, but I’d 
much rather if such extensions came with Darwin or at least Foundation.

milos

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to