On May 23, 2015, at 8:37 AM, Fritz Anderson <
fri...@manoverboard.org> wrote:
>
> The Swift interface for String includes String(format:, ...) only when you import Foundation. (You know the trick of `import Swift`, then command-clicking `Swift`.)
Yup. That’s where I went looking for String(format:) Didn’t see it there.
Where I didn’t look (and should have) is in Foundation. I see I have more
stuff to study.
> I'm pleased to see that SwiftDoc includes the Foundation extensions on its String page.
http://swiftdoc.org/type/String/ . There it is tagged as part of the extension.
I had assumed that SwiftDoc was the same as looking at Swift.swift.
My 2nd error. I should probably pay closer attention to SwiftDoc.
> Consider using string interpolation if you can tolerate the default formats. It would be interesting to see whether using NSNumberFormatter yourself would be a win.
I was mostly interested in “where is this stuff defined” as opposed to
any particular use. For most quick and dirty debug where I drop a println
into a function to see if values are as expected string interpolation works
quite well.
Thanks for the reply
Marc