[swift-users] Compiled swift module to be used in swift REPL

2016-07-13 Thread TUNG CK via swift-users
How can I use a compiled swift module to be use in swift REPL or playground ? such as in swift REPL import MyModule P.S. I could use it in swift package manager by adding it as a dependency in the Package.swift ___ swift-users mailing list swift-user

Re: [swift-users] How do you use protocol types?

2016-07-13 Thread Dan Loewenherz via swift-users
Unless you need to abstract what the Factory class does, I would eliminate AProto. class Factory { func constructInstance(_ t: T.Type) -> T { return t.init() } } If you truly want to genericize Factory, you can do the following: class Factory: AProto { typealias Elemen

Re: [swift-users] didSet and time when propagation of mutation happens

2016-07-13 Thread Zhao Xin via swift-users
I think the order is right. value.set >> value.didSet >> string.set >> string.didSet you expected value.set >> string.set >> value.didSet >> string.didSet is not correct. The value "1" is not you expected. However, that is something that I think is tricky. For closure > { > print(myClass.

[swift-users] How do you use protocol types?

2016-07-13 Thread Karl via swift-users
So I’m trying to work generically to construct things based on their conformance to a protocol with an initialiser. I’m sure this worked before; I’ve done it before. Maybe there have been some changes in the language or something, because I’ve tried everywhich-way and this just isn’t flying: ==

[swift-users] didSet and time when propagation of mutation happens

2016-07-13 Thread Diego Sánchez via swift-users
Hi all, The following snippet summarises an issue I was investigating: struct Observable { var value: T { didSet { print("Observable.didSet") callback?() } } var callback: (() -> Void)? } class MyClass { var myString: Observable { g

Re: [swift-users] Is there method indiicate current thread is mainthread in swift?

2016-07-13 Thread Mark Dalrymple via swift-users
To really split hairs, the iPhone 10.10 SDK from Xcode 8.0 beta 1 has the +isMainThread, and beta 2 has the class property :-) (being a collector of header files...) (and I do need to break that 8.2 for 8-beta-2 habit) ++md On Wed, Jul 13, 2016 at 11:34 AM, Jens Alfke wrote: > > > On Jul 13,

Re: [swift-users] Is there method indiicate current thread is mainthread in swift?

2016-07-13 Thread Jens Alfke via swift-users
> On Jul 13, 2016, at 7:20 AM, Mark Dalrymple via swift-users > wrote: > > It's a change in Xcode 8.2 - NSThread.isMainThread in ObjC land is now a > class property: ^^ Xcode 8.0 (beta) > In Xcode 8.1(and since iPhone OS 2) it was a regular old-school class method: ^

Re: [swift-users] Is there method indiicate current thread is mainthread in swift?

2016-07-13 Thread Jose Cheyo Jimenez via swift-users
Oh, I think foundation on Linux is not up to date yet. > On Jul 13, 2016, at 1:12 AM, qi bo wrote: > > my swift is 2016-05-09-a-ubuntu14.04. > import Foundation > if Thread.isMainThread { > ... > } > but unresolved identifier "Thread" occur > > > > On Wed, Jul 13, 2016 at 3:41 PM +0800, "Jos

Re: [swift-users] Is there method indiicate current thread is mainthread in swift?

2016-07-13 Thread Jose Cheyo Jimenez via swift-users
That's probably part of the new naming guidelines. > On Jul 13, 2016, at 7:13 AM, Nate Birkholz wrote: > > Is this a change to NSThread in the release, or to the language, dropping > empty () when calling methods? If the latter, what proposal is it? i can't > find it. > >> On Wed, Jul 13, 20

Re: [swift-users] Is there method indiicate current thread is mainthread in swift?

2016-07-13 Thread Mark Dalrymple via swift-users
It's a change in Xcode 8.2 - NSThread.isMainThread in ObjC land is now a class property: @property (class, readonly) BOOL isMainThread NS_AVAILABLE(10_5, 2_0); In Xcode 8.1(and since iPhone OS 2) it was a regular old-school class method: + (BOOL)isMainThread NS_AVAILABLE(10_5, 2_0) and so it lo

Re: [swift-users] Is there method indiicate current thread is mainthread in swift?

2016-07-13 Thread Nate Birkholz via swift-users
Is this a change to NSThread in the release, or to the language, dropping empty () when calling methods? If the latter, what proposal is it? i can't find it. On Wed, Jul 13, 2016 at 12:41 AM, Jose Cheyo Jimenez via swift-users < swift-users@swift.org> wrote: > //swift 2.2+ > NSThread.isMainThread

Re: [swift-users] Is there method indiicate current thread is mainthread in swift?

2016-07-13 Thread qi bo via swift-users
my swift is 2016-05-09-a-ubuntu14.04. import Foundation if Thread.isMainThread { ... } but unresolved identifier "Thread" occur On Wed, Jul 13, 2016 at 3:41 PM +0800, "Jose Cheyo Jimenez" mailto:ch...@masters3d.com>> wrote: //swift 2.2+ NSThread.isMainThread() //swift 3+ Thread.isMainThread

Re: [swift-users] Is there method indiicate current thread is mainthread in swift?

2016-07-13 Thread Jose Cheyo Jimenez via swift-users
//swift 2.2+ NSThread.isMainThread() //swift 3+ Thread.isMainThread > On Jul 13, 2016, at 12:27 AM, qi bo via swift-users > wrote: > > isMainThread is an method in object-c. how to indicate current thread is main > thread? > > thank you > Bob > > ___

[swift-users] Is there method indiicate current thread is mainthread in swift?

2016-07-13 Thread qi bo via swift-users
isMainThread is an method in object-c. how to indicate current thread is main thread? thank you Bob ___ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users