I\'d like to use a String value without the optional extension. I parse this data from firebase using the following code:
Database.database().reference(withP
Optional is because you're printing an optional value ?.
print("Value is", laststring!)
Above code will not print Optional. But avoid forcecasting and use guard for safety.
guard let value = lastString else {return}
print("Value is", value)
Or you can use Nil Coalescing operator.
print("Value is", laststring ?? "yourDefaultString")
So in case laststring is nil it will print yourDefaultString.
Important message for you, Use Dictionary instead of NSDictionary, use Array instead of NSArray this is swift.