How to open the Document files e.g(.pdf,.doc,.docx) in ios mobile when a button action using swift3.0?

Swift 3*, 4*, To open document and select any document, you are using UIDocumentPickerViewController then all documents presented in your iCloud, Files and in Google Drive will be shown if Google Drive is connected in user device. Then selected document need to download in your app and from there you can show it in WKWebView, … Read more

Add “Edit in Excel” or “Edit photo” extension

The only way to communicate with other iOS apps “locally” is using what is called URLSchemes. This is the documentation to use URLScheme with the MSOffice apps. https://msdn.microsoft.com/en-us/library/office/dn911482.aspx Answering the specific question: How to check if file (image, xls, doc or any other) can be opened to edit? You can use the UIApplication method called … Read more

Returning method object from inside block

You can’t. Embrace the fact that what you’re trying to do is asynchronous and add a completion block parameter to your getMyData method which is called when the inner completion handler is called. (And remove the return from the method signature): – (void)getMyDataWithCompletion:(void(^)(NSData *data))completion { MyUIDocument *doc = [[MyUIDocument alloc] initWithFileURL:fileURL]; [doc openWithCompletionHandler:^(BOOL success) { … Read more