In Swift 2.1 its possible to do the following:
if let _ = userInfo["msgIdenitifer"] where application.applicationState == .
Active {
//Do something
}
But not:
switch(userInfo)
{
case let _ = userInfo["msgIdenitifer"] where application.applicationState
== .Active:
//do something
break
}
···
*___________________________________*
*James⎥Lead Engineer*
*james@supmenow.com <james@supmenow.com>⎥supmenow.com <http://supmenow.com>*
*Sup*
*Runway East *
*10 Finsbury Square*
*London*
* EC2A 1AF *
dabrahams
(Dave Abrahams)
2
THat's correct. In a switch you'd need full pattern-matching syntax,
e.g.
case let unwrappedUserInfo? where application.application == .Active:
and you can't do an assignment right there.
perhaps you meant to switch(userInfo["msgIdenitifer"])
?
···
on Mon Feb 08 2016, James Campbell <swift-evolution@swift.org> wrote:
In Swift 2.1 its possible to do the following:
if let _ = userInfo["msgIdenitifer"] where application.applicationState == .
Active {
//Do something
}
But not:
switch(userInfo)
{
case let _ = userInfo["msgIdenitifer"] where application.applicationState
== .Active:
//do something
break
}
--
-Dave
akashivskyy
(Adrian Kashivskyy)
3
How can you switch a dictionary?
Regards,
Adrian Kashivskyy
Senior iOS Developer at Netguru
···
Wiadomość napisana przez James Campbell via swift-evolution <swift-evolution@swift.org> w dniu 08.02.2016, o godz. 12:01:
In Swift 2.1 its possible to do the following:
if let _ = userInfo["msgIdenitifer"] where application.applicationState == .Active {
//Do something
}
But not:
switch(userInfo)
{
case let _ = userInfo["msgIdenitifer"] where application.applicationState == .Active:
//do something
break
}
___________________________________
James⎥Lead Engineer
james@supmenow.com <mailto:james@supmenow.com>⎥supmenow.com <Supmenow.com is for sale | HugeDomains;
Sup
Runway East >
10 Finsbury Square
London
> EC2A 1AF
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution