I can't translate this Objective-C code into Swift
NSRunLoop *runloop = [NSRunLoop currentRunLoop];
[runloop addPort:[NSMachPort port] forMode:NSDefaultRunLoopMode];
[NSMachPort port]
let runloop:NSRunLoop = NSRunLoop.currentRunLoop()
runloop.addPort(NSMachPort.port, forMode: NSDefaultRunLoopMode)
NSMachPort.port
NSMachPort.port()
NSPort()
[NSMachPort port]
NSMachPort
is a subclass of NSPort
rather than the latter being an improved name, so NSPort()
will not construct an NSMachPort
.
NSMachPort()
is the equivalent of [NSMachPort port]
.