Skip to content

Commit

Permalink
Added more options to initializer.
Browse files Browse the repository at this point in the history
  • Loading branch information
psalzAppDev committed Sep 8, 2021
1 parent a658306 commit b17256d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ These screenshots are taken from my app TwoSlideOver. Check it out [here](https:

- `image`: The image you want to share and at the same time display as a preview.
- `activityItems`: All the items you want to share, with the `image` included.
- `activities`: Optional array of `UIActivity`
- `excludedTypes`: Optional array of excluded activity types.
- `completion`: An optional `UIActivityViewController.CompletionWithItemsHandler`
to handle any code after completion.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import UIKit

- `image`: The image you want to share and at the same time display as a preview.
- `activityItems`: All the items you want to share, with the `image` included.
- `activities`: Optional array of `UIActivity`
- `excludedTypes`: Optional array of excluded activity types.
- `completion`: An optional `UIActivityViewController.CompletionWithItemsHandler`
to handle any code after completion.

Expand All @@ -28,7 +30,7 @@ import UIKit
image: someImage,
activityItems: [someImage, self],
completion: { activity, completed, _, error in

if let error = error {
print("Error: \(error.localizedDescription)")
return
Expand Down Expand Up @@ -76,6 +78,8 @@ public class ActivityImageViewController: UIViewController {
- Parameters:
- image: The image you want to share and at the same time display as a preview.
- activityItems: All the items you want to share, with the `image` included.
- activities: Optional array of `UIActivity`
- excludedTypes: Optional array of excluded activity types.
- completion: An optional
`UIActivityViewController.CompletionWithItemsHandler` to handle any code after
completion.
Expand All @@ -86,6 +90,8 @@ public class ActivityImageViewController: UIViewController {
public init(
image: UIImage,
activityItems: [Any],
activities: [UIActivity]? = nil,
excludedTypes: [UIActivity.ActivityType] = [],
completion: UIActivityViewController.CompletionWithItemsHandler? = nil
) {

Expand All @@ -106,9 +112,12 @@ public class ActivityImageViewController: UIViewController {
// Setup the activity view controller.
self.activityViewController = UIActivityViewController(
activityItems: activityItems,
applicationActivities: nil
applicationActivities: activities
)

// Set optional excluded activity types.
self.activityViewController.excludedActivityTypes = excludedTypes

// Set the optional completion handler
self.activityViewController.completionWithItemsHandler = completion

Expand Down

0 comments on commit b17256d

Please sign in to comment.