I am new in Swift. I wish to access the sourceApplication value inside the options parameter of this method.
optional func application(_ app: UIApplication,
open url: URL,
options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool
I checked the documentation and I found out that UIApplicationOpenURLOptionsKey is a structure. It contains a type property: static let sourceApplication: UIApplicationOpenURLOptionsKey
But when I tried to access the sourceApplication value by doing this:
options.sourceApplication
...this error was thrown:
Value of type '
[UIApplicationOpenURLOptionsKey : Any]' has no member 'sourceApplication'
I have a thought that this might be a dictionary, But the type of the key is UIApplicationOpenURLOptionsKey. I don't have any idea how to access the value using the key type UIApplicationOpenURLOptionsKey.
I checked out tutorials point and some other sites, but didn't find a solution.
My questions are:
- How do I access the value named
sourceApplicationfromoptions? - What do you call this type of parameter? (
[UIApplicationOpenURLOptionsKey : Any] = [:])? Is this a dictionary?