mlevi
mlevi

Reputation: 1463

Using Reachability in Swift

I'm trying to implement reachability in Swift, I have it running in Swift but something is different. I can't seem to be able to do the block syntax that works in objc-c for checking the network connection:

Reachable.reachableBlock = ^(Reachability*reach)
    {
            NSLog(@"connection reached");

    };

I can't get this to work in swift, any ideas? Thanks.

Upvotes: 1

Views: 2078

Answers (1)

t0day
t0day

Reputation: 121

        Reachable.reachableBlock = {(reach:Reachability!) -> Void in
             println("connection reached")
        }

That's how you write blocks in Swift..

Upvotes: 1

Related Questions