init(type:)
init(type: SharingFlowType)
Parameter | Description |
---|---|
type | A type of SharingFlowType |
For more information, see SharingFlowType Enumeration.
==
presentOpenInMenuWithImage:inView:
Present the menu for sending image to Instagram app.
func presentOpenInMenuWithImage(_ image: UIImage!, inView view: UIView!)
This method calls the presentOpenInMenuWithImage:inView:documentInteractionDelegate:completion:
method setting the delegate
parameter and the completion
parameter nil
.
Available in 0.9.8 and later.
==
presentOpenInMenuWithImage:inView:documentInteractionDelegate:
Present the menu for sending image to Instagram app.
func presentOpenInMenuWithImage(_ image: UIImage!,
inView view: UIView!,
documentInteractionDelegate delegate: UIDocumentInteractionControllerDelegate?)
This method calls the presentOpenInMenuWithImage:inView:documentInteractionDelegate:completion:
method setting the completion
parameter nil
.
Available in 0.9.8 and later.
==
presentOpenInMenuWithImage:inView:completion:
Present the menu for sending image to Instagram app.
func presentOpenInMenuWithImage(_ image: UIImage!,
inView view: UIView!,
completion: ((sharingFlowResult: SharingFlowResult<String, ErrorType>) -> Void)?)
This method calls the presentOpenInMenuWithImage:inView:documentInteractionDelegate:completion:
method setting the delegate
parameter nil
.
Available in 0.9.8 and later.
==
presentOpenInMenuWithImage:inView:documentInteractionDelegate:completion:
Present the menu for sending image to Instagram app.
func presentOpenInMenuWithImage(_ image: UIImage!,
inView view: UIView!,
documentInteractionDelegate delegate: UIDocumentInteractionControllerDelegate?,
completion: ((sharingFlowResult: SharingFlowResult<String, ErrorType>) -> Void)?)
Parameter | Description |
---|---|
image | The image for sending to Instagram app. |
view | The view from which to display the menu. |
delegate | The delegate you want to receive document interaction notifications. You may specify nil for this parameter. |
completion | The block to execute after the presenting menu. You may specify nil for this parameter. |
This method is invoked if the hasInstagramApp
property is true
. To avoid blocking the main thread, it is invoked asynchronously with Grand Central Dispatch (GCD).
First, write a temporary image file in tmp/
directory. The image data is written to a backup file, and then—assuming no errors occur—the backup file is renamed to the name specified by path. The image file is named jpmarthaeggsbenedict.ig
or jpmarthaeggsbenedict.igo
according to the SharingFlowType
enumeration. For more information, see NSData Class Reference.
Then, call the presentOpenInMenuFromRect:inView:animated:
method of an instance of the UIDocumentInteractionController
class in main thread.
You can implement a delegate object to track user interactions with menu items displayed by the document interaction controller. For more information, see UIDocumentInteractionControllerDelegate Protocol Reference.
The completion handler is called after the presentOpenInMenuFromRect:inView:animated:
method is called of an instance of the UIDocumentInteractionController
class.
UIDocumentInteractionController Class Reference
This method displays the options menu asynchronously. The document interaction controller dismisses the menu automatically when the user selects an appropriate option.
sharingFlow.presentOpenInMenuWithImage(YourImage, inView: YourView, documentInteractionDelegate: self) { (sharingFlowResult) -> Void in
switch sharingFlowResult {
case .Success(let imagePath):
print("Success: \(imagePath)")
case let .Failure(imagePath, errorType):
print("ImagePath: \(imagePath), ErrorType: \(errorType)")
}
}
==
removeTemporaryImage
Remove temporary image file in tmp/
directory.
func removeTemporaryImage()
It is not usually necessary to use this method because this library overwrites an existing file.
This method calls the removeTemporaryImage:
method setting the completion
parameter nil
.
Available in 0.9.8 and later.
==
removeTemporaryImage:
Remove temporary image file in tmp/
directory.
func removeTemporaryImage(completionHandler completion: ((sharingFlowResult: SharingFlowResult<String, ErrorType>) -> Void)?)
Parameter | Description |
---|---|
completion | The block to execute after the removing temporary image finishes. You may specify nil for this parameter. |
It is not usually necessary to use this method because this library overwrites an existing file.
sharingFlow.removeTemporaryImage { (sharingFlowResult) -> Void in
switch sharingFlowResult {
case .Success(let imagePath):
print("Success: \(imagePath)")
case let .Failure(imagePath, errorType):
print("ImagePath: \(imagePath), ErrorType: \(errorType)")
}
}
==
hasInstagramApp
Returns a Boolean value indicating whether or not Instagram app is installed on the iOS device.
var hasInstagramApp: Bool { get }
If true
, the iOS device has Instagram app; otherwise it does not.