I personally find it weird behaviour that it will return the current device name when executing the following code:
Would return Zandor's iPhone even though I'm kind of referencing a different device.
I think putting a fatalError(...) or returning nil would be a more logical behaviour. fatalError(...) would notify the developer of incorrect behaviour immediately.
Another solution could be to check if we are referencing the current device:
and if not, do something like described here: https://www.hackingwithswift.com/example-code/language/how-to-add-warnings-and-errors-to-your-code-using-warning-and-error
#error("Can't get the name of a different device from the current one.")
This would produce an error at compilation when my first example is being used.
Could be a possible change for 2.0.
I personally find it weird behaviour that it will return the current device name when executing the following code:
Would return
Zandor's iPhoneeven though I'm kind of referencing a different device.I think putting a
fatalError(...)or returning nil would be a more logical behaviour.fatalError(...)would notify the developer of incorrect behaviour immediately.Another solution could be to check if we are referencing the current device:
and if not, do something like described here: https://www.hackingwithswift.com/example-code/language/how-to-add-warnings-and-errors-to-your-code-using-warning-and-error
#error("Can't get the name of a different device from the current one.")This would produce an error at compilation when my first example is being used.
Could be a possible change for 2.0.