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

Mark Dalrymple markd at borkware.com
Wed Jul 13 09:20:18 CDT 2016


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 loses the paren requirement now.

++md






On Wed, Jul 13, 2016 at 10:13 AM, Nate Birkholz via swift-users <
swift-users at swift.org> 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, 2016 at 12:41 AM, Jose Cheyo Jimenez via swift-users <
> swift-users at swift.org> wrote:
>
>> //swift 2.2+
>> NSThread.isMainThread()
>>
>> //swift 3+
>> Thread.isMainThread
>>
>>
>> On Jul 13, 2016, at 12:27 AM, qi bo via swift-users <
>> swift-users at swift.org> wrote:
>>
>> isMainThread is an method in object-c. how to indicate current thread is
>> main thread?
>>
>> thank you
>> Bob
>> _______________________________________________
>> swift-users mailing list
>> swift-users at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-users
>>
>>
>>
>> _______________________________________________
>> swift-users mailing list
>> swift-users at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-users
>>
>>
>
>
> --
> Nate Birkholz
>
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160713/2b706f26/attachment.html>


More information about the swift-users mailing list