Skip to content

Instantly share code, notes, and snippets.

@xxKRASHxx
Forked from shu223/CustomActivity.swift
Created July 9, 2018 15:26
Show Gist options
  • Save xxKRASHxx/c0baa5b65a249c8b01119888dad7de8c to your computer and use it in GitHub Desktop.
Save xxKRASHxx/c0baa5b65a249c8b01119888dad7de8c to your computer and use it in GitHub Desktop.
Custom UIActivity in Swift 3
import UIKit
class CustomActivity: UIActivity {
override class var activityCategory: UIActivityCategory {
return .action
}
override var activityType: UIActivityType? {
guard let bundleId = Bundle.main.bundleIdentifier else {return nil}
return UIActivityType(rawValue: bundleId + "\(self.classForCoder)")
}
override var activityTitle: String? {
return <# Title #>
}
override var activityImage: UIImage? {
return <# UIImage #>
}
override func canPerform(withActivityItems activityItems: [Any]) -> Bool {
return true
}
override func prepare(withActivityItems activityItems: [Any]) {
//
}
override func perform() {
activityDidFinish(true)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment