Reputation: 334
here is my code.
let myDeepLinkAction: UAAction = UAAction(block: {(args:UAActionArguments, handler:UAActionCompletionHandler) -> Void in
handler(UAActionResult.empty())
}, acceptingArguments: {(arguments: UAActionArguments) in
if arguments.situation == UASituation.backgroundPush {
return true
}
return ((arguments.value! as AnyObject).isKind(of: NSString) || (arguments.value! as AnyObject).isKind(of: URL))
})
that type error is coming after swift version conversion 2.2 to 3.0,pls give me solution as possible.
Upvotes: 2
Views: 833
Reputation: 31
I was having this issue when I updated to swift 3 in xcode 8
for view in subViews {
if ((view as AnyObject).isKind(of : UIScrollView))
{
scrollView = view as? UIScrollView
}
It was showing error "Cannot call value of non-function type '((AnyClass) -> Bool)!" Then I added this "classForKeyedArchiver()" for view in subViews {
if ((view as AnyObject).isKind(of :
UIScrollView().classForKeyedArchiver!))
{
scrollView = view as? UIScrollView
}
Thanks a lot,it worked for me.
Upvotes: 0
Reputation: 886
Make use of classForKeyedArchiver property
For eg : If you want to find out if a view controller belongs to a certain class , use the following snippet
if sampleController.isKind( of : listOfFlowersViewController.classForKeyedArchiver()!)
{
//your success code here
}
Upvotes: 0
Reputation: 334
I have found the solution,its simple
let myDeepLinkAction: UAAction = UAAction(block: {(args:UAActionArguments, handler:UAActionCompletionHandler) -> Void in
handler(UAActionResult.empty())
}, acceptingArguments: {(arguments: UAActionArguments) in
if arguments.situation == UASituation.backgroundPush {
return true
}
return (arguments.value! is NSString || arguments.value! is URL)
})
return (arguments.value! is NSString || arguments.value! is URL)
Upvotes: 1