setrminds.blogg.se

Xcode swift share location with friends
Xcode swift share location with friends












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) Select a template: Choose a template that best matches your intended app. Create a new project: Click on Create a new Xcode project or go to File > New > Project.

Xcode swift share location with friends install#

If this is your first time opening Xcode, you may need to install additional components. On ViewDidLoad navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Share", style. Launch Xcode: Open Xcode from your Applications folder. This is how I implemented sharing with Swift 4/5 using a right button on the Navigation Controller. Self.present(activityViewController, animated: true, completion: nil) ,Ī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 = [

xcode swift share location with friends

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")!

xcode swift share location with friends

Let secondActivityItem : NSURL = NSURL(string: "")! Let firstActivityItem = "Description you want."












Xcode swift share location with friends