Thursday, July 14, 2022
HomeiOS developmentios - SwiftUI UIDocumentInteractionController SQLite

ios – SwiftUI UIDocumentInteractionController SQLite


I am utilizing SwiftUI and have knowledge saving to Paperwork’ Listing as a SQLite DB.

I would like choice to press a button after which have a popup that allows you to open up the DB in some iOS SQLite DB Viewer app.

I’ve used UIDocumentInteractionController previously to open up .csv recordsdata in iOS Excel and Numbers (however in Obj-C)

I am seeking to do one thing like…

//  Upon btn click on to open DB up in exterior app...
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,     NSUserDomainMask, YES);
    NSString *documentPath = [paths objectAtIndex:0];
    
    NSString *filePath = [NSString stringWithFormat:@"%@/%@.sqlite", documentPath,type];
    documentController =
    [UIDocumentInteractionController
     interactionControllerWithURL:[NSURL fileURLWithPath:filePath]];
    documentController.UTI = @"public.sqlite";

    [documentController presentOpenInMenuFromRect:CGRectZero
                                           inView:self.view
                                         animated:YES];

How can I obtain this? Thanks!

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments