ios - Ambiguous use of subscript swift 2.2 -


i error right before ["toposition"] saying ambiguous use of subscript

guard let toloc = self.currentdetailobj!["toposition"][0] as? pfgeopoint else {             return } 

in previous statement works fine

    guard let fromloc = self.currentdetailobj!["fromposition"] as? pfgeopoint else{         return     } 

why first statement not work? need position @ index 0.

use .first

guard let toloc = self.currentdetailobj?["toposition"].first as? pfgeopoint else {             return } 

Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -