FAQ Database Discussion Community

How to Supress implicit return from a closure with Void return type in Swift

lets consider we have a closure like: (used as completionHandler) func doSomething (completionHandler : (done : Bool)->Void )->Void { ... completionHandler(true) } now if we want to do something like that : doSomething({ (done : Bool)-> Void var data : NSDictionary = NSDictionary() data.setValue("data1", forKey: "data1") // 1 data.setValue("data2", forKey:...

Is There A Neat Way to Attach a Completion Block to an NSURLSessionDataDelegate Callback in Swift?

OK, here's the deal: I have a URL call I'm making in a Swift app, sort of like so: /*! @brief Tests a given Root Server URL for validity @discussion What we do here, is append "/client_interface/serverInfo.xml" to the given URI, and test that for validity. @param inURIAsAString This contains...

How to convert completion block of objective c to Swift?

I am new in swift and try to convert objective c block syntax to swift Xcode 6.3.2 completion block typedef : typealias CompletionWithBoolBlock = (Bool, NSError, NSString) -> Void [Model insertObjectWithTable:@"tblStudent" values:dict completion:^(BOOL success, NSError *responseError, NSString *object){ if(success){ NSLog(@"inserted"); } else { NSLog(@"Not inserted, %@",responseError.description); } }]; After surfing...