THREAD 1: EXC BAD_INSTRUCTIONS

private var _Bids: Int!

private var _Description: String!

private var _ImageURL: String!

private var _postKey: String!

var Bids: Int {

return _Bids

}

var Description: String {

return _Description // the issue appears here

}

var ImageURL: String{

return _ImageURL

}

var pokey: String {

return _postKey

}

init(Bids:Int, Description: String, ImageURL: String) {

self._Bids = Bids

self._Description = Description

self._ImageURL = Description

}

Replies

To start, I recommend you read this post, which provides some general background to

EXC_BAD_INSTRUCTION
.

In your case,

_Description
is an implicitly unwrapped option, so it’s likely that the crash within
Description
is caused by it being nil.

btw Some suggestions:

  • Swift has strong naming conventions and I recommend you follow them. To me

    Description
    looks like a type; a property would be called
    description
    . Read the API Design Guidelines for the details.
  • When you post code, it’s a good idea to put it in a code block (like the

    <>
    icon). That way it’ll be easier to read and have line numbers that you can refer to.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"