apple ios

Swift 101 — Basic Property

Class and Struct are the two major reminiscence sort in Swift. Class is in reference sort which issues to the reminiscence cope with of a reminiscence however struct is in price sort which issues to the information saved on the reminiscence cope with.

Therefore, a continuing elegance example has a continuing reminiscence cope with and its variable information may also be modified at anytime. (*15*), a continuing struct example has consistent information however variable cope with. Refer to line 15, It will throw a assemble error when the information of a continuing struct is modified.

Struct is really useful to be the primary selection. (*15*), developer will have to select elegance when code is designed to be subclassed and needs to be accessed via Objective-C codes.