Re: [swift-users] Localization in Swift.

2016-11-01 Thread Zhao Xin via swift-users
I have already give a workable implementation above. let count = 10 > let says = NSLocalizedString(" > ​blabla > \(count) > ​blabla > ", comment: " > ​blabla > ") ​to let says = > String.localizedStringWithFormat(NSLocalizedString("​blabla%​@​blabla", > comment: "​blabla"), ​String(​count​)​

Re: [swift-users] Swift and Xcode along with Playgrounds is full of bugs

2016-11-01 Thread Shyamal Chandra via swift-users
Hi Jens, 1. I think you have me confused; I am not yelling. I didn't flame Tim Cook or Chris Latter. 2. Github would be a great place to use for the extensible documentation. 3. Volunteers are great because they might get jobs from Apple or become great evangelists for knowing industry-quality co

Re: [swift-users] Localization in Swift.

2016-11-01 Thread Jens Alfke via swift-users
> On Nov 1, 2016, at 10:56 PM, Zhao Xin wrote: > > I am not talking to eliminate "%" style function. I am talking to add more > compatibility to `NSLocalizedString` with `\(foo)` style. I don’t think the ExpressibleByStringInterpolation protocol provides enough information to make this work.

Re: [swift-users] Swift and Xcode along with Playgrounds is full of bugs

2016-11-01 Thread Jens Alfke via swift-users
> On Nov 1, 2016, at 9:50 PM, Shyamal Chandra via swift-users > wrote: > > Why don't you make the Playgrounds open source so I can investigate? I’ve been hearing people tell Apple “why don’t you make ___ open source” for as long as the term ‘open source’ has existed. Sometimes it happens, bu

Re: [swift-users] Localization in Swift.

2016-11-01 Thread Zhao Xin via swift-users
I am not talking to eliminate "%" style function. I am talking to add more compatibility to `NSLocalizedString` with `\(foo)` style. As there is no rule forbidding that, it should work. If someone doesn't need the flexible parts, why he has to use the complicated way? Zhaoxin On Wed, Nov 2, 2016

Re: [swift-users] Localization in Swift.

2016-11-01 Thread Jens Alfke via swift-users
> On Nov 1, 2016, at 10:40 PM, Zhao Xin wrote: > > For example, if I want show the user that I have to ask him to give me > permission of a folder, the `url.path` has no need to translate. We’re getting off-topic, but paths do need to be translated, at least on Mac systems. The names of many

Re: [swift-users] Localization in Swift.

2016-11-01 Thread Zhao Xin via swift-users
I has known that, and it is the developer's choice, which means, the developer has already known that. There are many circumstances that there are no needs to translate at all. For example, if I want show the user that I have to ask him to give me permission of a folder, the `url.path` has no need

[swift-users] Fwd: Swift and Xcode along with Playgrounds is full of bugs

2016-11-01 Thread Shyamal Chandra via swift-users
Hi Tim, Hope you are doing well! The quality of response time and stability of Xcode Playgrounds is questionable. Also, the support and forum response time are not adequate. Could you please open-source Xcode Playgrounds so I can look at the source code to fix the problems or provide better docu

Re: [swift-users] Swift and Xcode along with Playgrounds is full of bugs

2016-11-01 Thread Shyamal Chandra via swift-users
Hi Chris, First of all, there is tremendous instability with Xcode Playgrounds. I paste the same simple code into Xcode Playgrounds; sometimes, it works and sometimes, it doesn't work. Why don't you make the Playgrounds open source so I can investigate? You should tell this to Tim Cook as soon

Re: [swift-users] Localization in Swift.

2016-11-01 Thread Jens Alfke via swift-users
> On Nov 1, 2016, at 7:52 PM, Zhao Xin wrote: > > The second should be > > let says = > String.localizedStringWithFormat(NSLocalizedString("​blabla%​@​blabla", > comment: "​blabla"), ​String(​count​)​) That’s not quite right, because the conversion of `count` to a string won’t be localized.

Re: [swift-users] Localization in Swift.

2016-11-01 Thread Zhao Xin via swift-users
The second should be let says = String.localizedStringWithFormat(NSLocalizedString(" > ​blabla > % > ​@ > ​blabla > ", comment: " > ​blabla > "), > ​String(​ > count > ​)​ > ) ​Zhaoxin​ On Wed, Nov 2, 2016 at 10:50 AM, Zhao Xin wrote: > I think in Swift. > > let count = 10 >> let says = NSLoc

Re: [swift-users] Localization in Swift.

2016-11-01 Thread Zhao Xin via swift-users
I think in Swift. let count = 10 > let says = NSLocalizedString(" > ​blabla > \(count) > ​blabla > ", comment: " > ​blabla > ") ​can be roughly interpreted as let says = String.localizedStringWithFormat(NSLocalizedString(" > ​blabla > % > ​@ > ​blabla > ", comment: " > ​blabla > "), count) ​S

[swift-users] Type checker not accepting subclass(protocol conformance) as a valid type inside a closure in a protocol with constraint where Self: MyClass

2016-11-01 Thread Henrique Valcanaia via swift-users
Hey everyone. I’m having some trouble with the following code, more precisely I’m getting the error "Cannot convert value of type '([Self]?, Error?) -> Void?' to expected argument type ‘([SomeModel]?, Error?) -> Void?’” when trying to call “find2(withBlock: ([SomeModel]?, Error?) -> Void?)” ins

Re: [swift-users] Custom little/big endian data structure.

2016-11-01 Thread Adrian Zubarev via swift-users
Hi Chris, thank you for your answer. I can’t wait for property behaviors, it’s going to be such a powerful feature. :) --  Adrian Zubarev Sent with Airmail Am 1. November 2016 um 18:34:55, Chris Lattner (clatt...@apple.com) schrieb: On Oct 30, 2016, at 12:50 PM, Adrian Zubarev via swift-users

Re: [swift-users] What is "binding" memory?

2016-11-01 Thread Andrew Trick via swift-users
> On Nov 1, 2016, at 11:55 AM, Manfred Schubert via swift-users > wrote: > > The "UnsafeRawPointer Migration" guide talks about "binding memory to a type“ > as if that was a well known term. I have never heard of it yet though, and > googling it returns no relevant results. I do not understan

Re: [swift-users] What is "binding" memory?

2016-11-01 Thread Michael Ilseman via swift-users
> On Nov 1, 2016, at 11:55 AM, Manfred Schubert via swift-users > wrote: > > The "UnsafeRawPointer Migration" guide talks about "binding memory to a type“ > as if that was a well known term. I have never heard of it yet though, and > googling it returns no relevant results. I do not understan

Re: [swift-users] What is "binding" memory?

2016-11-01 Thread Rien via swift-users
The way I understand it, it prepares a memory structure that refers to the ‘raw memory’ such that it can be used to access the referenced memory according to the type ‘bound’ to. Regards, Rien Site: http://balancingrock.nl Blog: http://swiftrien.blogspot.com Github: http://github.com/Swiftrien

[swift-users] What is "binding" memory?

2016-11-01 Thread Manfred Schubert via swift-users
The "UnsafeRawPointer Migration" guide talks about "binding memory to a type“ as if that was a well known term. I have never heard of it yet though, and googling it returns no relevant results. I do not understand what binding memory is supposed to do. The migration guide says "Binding uninitia

[swift-users] please unsubscribe

2016-11-01 Thread Cavit Artanlar via swift-users
___ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users

Re: [swift-users] Custom little/big endian data structure.

2016-11-01 Thread Chris Lattner via swift-users
> On Oct 30, 2016, at 12:50 PM, Adrian Zubarev via swift-users > wrote: > > Hi there, > > is there actually a way to build a custom data structure that will > automatically be converted to little/big endian on a little/big endian > system, just like (U)Int16/32/64 do? > > I could build as a

Re: [swift-users] Localization in Swift.

2016-11-01 Thread Jens Alfke via swift-users
> On Nov 1, 2016, at 1:53 AM, Zhao Xin via swift-users > wrote: > > I began to realize that` \(count)` was not dealed well in localization. The > compiler calculated the full string then looking for the translation, instead > of looking for the translation first. NSLocalizedString was design

Re: [swift-users] Element vs. Iterator.Element

2016-11-01 Thread Toni Suter via swift-users
Ok, I have filed a bug: https://bugs.swift.org/browse/SR-3102 Best regards, Toni > Am 31.10.2016 um 19:32 schrieb Dave Abrahams via swift-users > : > > > on Mon Oct 31 2016, Toni Suter > wrote: > >> Hi, >> >> This ex

Re: [swift-users] Localization in Swift.

2016-11-01 Thread Brent Royal-Gordon via swift-users
> I managed to replace my code with > > let newSays = String.localizedStringWithFormat(NSLocalizedString("It runs %d > times", comment: "new run times"), count) > > However, I still thing it would be better if we could use \(foo) directly, as > it is more Swift style. Any idea why this can't h

[swift-users] Localization in Swift.

2016-11-01 Thread Zhao Xin via swift-users
I encountered a localization problem today. At first I translated a string like this. let count = 10 > let says = NSLocalizedString("It runs \(count) times", comment: "run > times") I couldn't get the translation taking effect. So I open the setting "Localization Debugging" in scheme and get th