![]() ![]() Before we carry on, let me explain what items are. ![]() In viewDidLoad of your ViewController, do this: navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem. Let's start implementing this method by replacing the first argument with the following: let activityViewController UIActivityViewController( activityItems: items, applicationActivities: nil) This will initialise our UIActivityViewController with the items that we want to share. Improving on JP Aquino's code for Swift 5 for share action rightBarButtonItem on the Navigation Controller. Select the iOS tab, click on Share Extension and then Next. plain, target: self, action: #selector(share(sender:)))Ĭreate the function func share(sender:UIView) You can either choose to open a new project to start adding share extension from scratch or open an existing one you want to add the extension. On ViewDidLoad navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Share", style. If you have created a free repository on GitHub, the entire world. This is how I implemented sharing with Swift 4/5 using a right button on the Navigation Controller. By all other developers I mean those with whom you have chosen to share your project. Self.present(activityViewController, animated: true, completion: nil) ,ĪctivityViewController.isModalInPresentation = true ] as? UIActivityItemsConfigurationReadingĪctivityViewController.excludedActivityTypes = [ SwiftUI: Custom Popup Dadd圜oding - Learn Swift, SwiftUI. SwiftUI provides many APIs to show alerts, popovers, action sheets, modal sheets. Popup is a kind of modal that appears in front of app content to provide critical information or ask for a decision. In the project navigator, right-click SidebarDemo folder and select New Group. Test View Alan Docs yoni-g / AnalyticsManager.swift. After you extract the file, you should find SWRevealViewController.h and SWRevealViewController.m. 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, first download the library from GitHub and extract the zipped file. This lines is for the popover you need to show in iPadĪctivityViewController.popoverPresentationController?.sourceView = (sender as! UIButton) Let activityViewController : UIActivityViewController = UIActivityViewController(ĪctivityItems:, applicationActivities: nil) Let image : UIImage = UIImage(named: "your-image-name")! Let secondActivityItem : NSURL = NSURL(string: "")! Let firstActivityItem = "Description you want." ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |