In swift, a computed property cannot throw an exception - if you want to be sure, check out Throwing Functions and Methods section of Swift 4.1 language reference. So even if the rest of your code made sense, you simply cannot throw an exception from a computed property.
Anyway, test self == nil
makes no sense - self
cannot really ever be nil. If an object is nil, it does not exist, thus you cannot access any of its properties/methods (it does not exist, what would you be accessing?).
E.g., if you try to call yourObject?.myString
, the getter for myString
will NOT be executed at all, because yourObject
is nil, it does not exist. If you try to force it using !
it will crash right away.