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
Post a Comment