Trying to re-integrate the sharing button in my application. Apple again changed things in Swift 3
for iOS 10
. I just updated to the Xcode 8
release version and it's been giving me some issues with UIActivities
.
Found that many of them now begin with UIActivityType.
in order for the compiler to not fail. However many of them still are using com.apple
it also made me cast the activityType
array to type [Any]
for some reason.
So with that... Does anyone know why they did that? and what do you put in the for argument in the activityTypesToExclude.contains(where: (Any) throws -> Bool)
method?
internal func _shouldExcludeActivityType(_ activity: UIActivity) -> Bool {
let activityTypesToExclude = [
"com.apple.reminders.RemindersEditorExtension",
UIActivityType.openInIBooks,
UIActivityType.print,
UIActivityType.assignToContact,
UIActivityType.postToWeibo,
"com.google.Drive.ShareExtension",
"com.apple.mobileslideshow.StreamShareService"
] as [Any]
if let actType = activity.activityType {
if activityTypesToExclude.contains(where: (Any) throws -> Bool) {
return true
}
else if super.excludedActivityTypes != nil {
return super.excludedActivityTypes!.contains(actType)
}
}
return false
}