Home
Blogs
Questions
Jobs
Monetize

Home

About Us

Blogs

Questions

Jobs

Monetize

Post Job

banner

Questions about swift-optionals

Read more about swift-optionals

python (65.2k questions)

javascript (44.3k questions)

reactjs (22.7k questions)

java (20.8k questions)

c# (17.4k questions)

html (16.3k questions)

r (13.7k questions)

android (13k questions)

Questions - swift-optionals

how can i fix this? it tells me that optional "!" is not needed

var camera = UIImage(named: "1")! var city = UIImage(named: "2")! var animals = UIImage(named: "3")! var flowers = UIImage(named: "4")! var stand = UIImage(...
test-img

Nika Erema

swift

swift-optionals

Votes: 0

Answers: 1

Latest Answer

Declare images like let camera: UIImage = UIImage(named: "1") ?? UIImage() and then you will be sure that even when there is no image named "1" the app won't crash. You can also c...
test-img

stoikokolev

Generic decoding json into object with optionals

I wrote an extension to Decodable with the hopes of having a generic constructor for objects from json strings, it looks like this: extension Decodable { init?(with dictionary: [String: Any]) { ...
test-img

Sebby Fay

json

swift

decoder

swift-optionals

Votes: 0

Answers: 1

Latest Answer

if let jsonData = data { do { var model = try decoder.decode(Goer.self, from: jsonData) print("model:\(model)") } catch { print("error:\(error)") ...
test-img

Leo Chen

Posts

Questions

Blogs

Jobs

The ultimate platform for coders and IT specialists

About

  • Company
  • Support

  • Platform

  • Terms & Conditions
  • Privacy statement
  • Cookie policy
  • Cookie option
  • OnlyCoders © 2025  |  All rights reserved