The OSSharing class provides support for sharing content from your app.
Load() This event is called when the object becames available in the current runtime system.
Unload() This event is called when the object has been removed from the current runtime system (but not yet deallocated).
var items: List The array of data objects on which to perform the activity. The type of objects in the array is variable and dependent on the data your application manages. For example, the data might consist of one or more string or image objects representing the currently selected content.
var objectName: String The name of the object.
func shareImage(image: Image) Share image with others apps.
func shareData(data: Data) Share raw data with others apps.
func shareString(string: String) Share a string with others apps.
func shareURL(string: String) Share URL with others apps.
func show() Display sharing dialog to the user.
func addExcludedType(options: Int) Add a service that you do not want displayed to the user. You might exclude services that you feel are not suitable for the content you are providing. For example, you might not want to allow the user to print a specific image. If the value of this property is nil, no services are excluded.
Share an Image:
var image = MyGreatImage; OSSharing.shareImage(image);
Share a String:
var s = "Hello World"; OSSharing.shareString(s);
Share a URL:
var url= "https://creolabs.com"; OSSharing.shareURL(url);
Share an Image and a String:
var image = MyGreatImage; var s = "Hello World"; var share: OSSharing = OSSharing(); share.items = [image, s]; share.show();