I would like to show only mail, imessages and whatsapp in uiactivitycontroller.
Exclude activity types only excludes default types and shows others.
Is there a way to show only the above mentioned activity.
Thanks in advance
I would like to show only mail, imessages and whatsapp in uiactivitycontroller.
Exclude activity types only excludes default types and shows others.
Is there a way to show only the above mentioned activity.
Thanks in advance
Just Add a method named shouldExcludeActivityType to UIActivityViewController and return false for the activity items you want show and return true for the rest of the items.
import UIKit
class MyActivityViewController: UIActivityViewController {
func _shouldExcludeActivityType(activity: UIActivity) -> Bool {
let activityTypesToExclude = [
"com.apple.mail",
"com.apple.iMesaage",
"Whatsapp bundle id"
]
if let actType = activity.activityType() {
if activityTypesToExclude.contains(actType) {
return false
}
}
return true
}
}