-5

I started developing apps using Swift directly so i have little to know idea about Objective C, however i had to take up a project which was implemented in Objective C and fix few bugs.

I came across a code in Swift which i want to convert to Objective C

func mySpecialFunction(){

let importMenu = UIDocumentMenuViewController(documentTypes: [String(kUTTypePDF)], in: .import)
            importMenu.delegate = self
            importMenu.modalPresentationStyle = .formSheet       
            self.present(importMenu, animated: true, completion: nil)
}

Now i have done some research and got this

UIDocumentMenuViewController *importMenu = *Code Here* ;
importMenu.delegate = self;
importMenu.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:importMenu animated:YES];

Can anyone help me how to can i get the first line converted to Objective C in the code ?

Michael Hulet
  • 3,253
  • 1
  • 16
  • 33
Teja C
  • 11
  • 1
  • 5
  • Possible duplicate of [How to initialise UIDocumentPickerViewController with all type of UTIs](https://stackoverflow.com/questions/33099775/how-to-initialise-uidocumentpickerviewcontroller-with-all-type-of-utis) – Yagnesh Dobariya Oct 27 '17 at 08:26

2 Answers2

-1

Please try this.

 UIDocumentMenuViewController *importMenu = [[UIDocumentMenuViewController alloc] initWithDocumentTypes:@[(__bridge NSString*)kUTTypeContent] inMode:UIDocumentPickerModeImport];
Shiv Kumar
  • 932
  • 7
  • 12
-1
UIDocumentMenuViewController *importMenu = [[UIDocumentMenuViewController alloc] initWithDocumentTypes:@[@"public.item", (__bridge NSString *) kUTTypeContent, (__bridge NSString *) kUTTypeData, (__bridge NSString *) kUTTypePackage, (__bridge NSString *) kUTTypeDiskImage, @"com.apple.iwork.pages.pages", @"com.apple.iwork.numbers.numbers", @"com.apple.iwork.keynote.key"] inMode:UIDocumentPickerModeImport];

Use Above Code

9to5ios
  • 5,319
  • 2
  • 37
  • 65
Akshay Degada
  • 139
  • 2
  • 13