You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
493 B
21 lines
493 B
// |
|
// DispatchQueue+Extensions.swift |
|
// Platform |
|
// |
|
// Created by Krunoslav Zaher on 10/22/16. |
|
// Copyright © 2016 Krunoslav Zaher. All rights reserved. |
|
// |
|
|
|
import Dispatch |
|
|
|
extension DispatchQueue { |
|
private static var token: DispatchSpecificKey<()> = { |
|
let key = DispatchSpecificKey<()>() |
|
DispatchQueue.main.setSpecific(key: key, value: ()) |
|
return key |
|
}() |
|
|
|
static var isMain: Bool { |
|
return DispatchQueue.getSpecific(key: token) != nil |
|
} |
|
}
|
|
|