1

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.

mlevi
  • 1,433
  • 3
  • 18
  • 30

1 Answers1

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

That's how you write blocks in Swift..

t0day
  • 121
  • 8