Events sub-system - Subscribe to events

Does someone know how to use this code in Swift 3?

SparkEventHandler handler = ^(SparkEvent *event, NSError *error) {
        if (!error)
            dispatch_async(dispatch_get_main_queue(), ^{
                NSLog(@"Got Event %@ with data: %@",event.event,;
            NSLog(@"Error occured: %@",error.localizedDescription);


id eventListenerID = [[SparkCloud sharedInstance] subscribeToAllEventsWithPrefix:@"temp" handler:handler];

The code is from Particle docs Reference. I want to create an app that subscribes to an Particle.publish event from one of my devices and I don’t want to require log in. The app should simply show status of an external process.