![]() In viewDidLoad of your ViewController, do this: navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem. Improving on JP Aquino's code for Swift 5 for share action rightBarButtonItem on the Navigation Controller. plain, target: self, action: #selector(share(sender:)))Ĭreate the function func share(sender:UIView) On ViewDidLoad navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Share", style. This is how I implemented sharing with Swift 4/5 using a right button on the Navigation Controller. Your page: You can create a post for your page from the top of the News Feed. This will vary depending on where you want to create your post. Self.present(activityViewController, animated: true, completion: nil) Navigate to the page where you want to post. ,ĪctivityViewController.isModalInPresentation = true ] as? UIActivityItemsConfigurationReadingĪctivityViewController.excludedActivityTypes = [ This line remove the arrow of the popover to show in iPadĪctivityViewController.popoverPresentationController?.permittedArrowDirections = UIPopoverArrowDirection.downĪctivityViewController.popoverPresentationController?.sourceRect = CGRect(x: 150, y: 150, width: 0, height: 0)ĪctivityViewController.activityItemsConfiguration = [ So as long as it is formatted in FAT32 format you should be fine. It could read all files and folders on the disk which seems to confirm that the size of the memory stick is irrelevant. I tried an 8gb usb stick with it last night and as that was formatted in FAT32 it worked perfectly. This lines is for the popover you need to show in iPadĪctivityViewController.popoverPresentationController?.sourceView = (sender as! UIButton) SwiftUI can detect when your app moves to the background (i.e., when the user returns to the home screen), and when it comes back to the foreground, and if you put those two together it allows us to make sure our app pauses and resumes work depending on whether the user can see it right now or not. My experience seems to confirm that it is a formatting issue. Let activityViewController : UIActivityViewController = UIActivityViewController(ĪctivityItems:, applicationActivities: nil) Let image : UIImage = UIImage(named: "your-image-name")! But, because we made our items an array of type Any, we can share multiple different types of content. If we wanted to share an image, the items array would contain an image/s. So if we wanted to share text, the items in this example will be an array with text in it. modifier(ShareSheetModifer(shareSheetItems: 'Hello, world')) While this is already okay to use, I personally don’t like to write my modifiers in this way. Let secondActivityItem : NSURL = NSURL(string: "")! I am implementing FB share feature on iOS app using Swift, the module I am using is Facebookshare, I already got it right but I need to know the result. Items are all the things that we would like to share. Then to use it, add the modifier to your SwiftUI Element like the following with the items that you want to share. ![]() ![]() Let firstActivityItem = "Description you want."
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |