Tag Archives: enumeration

init method simple example swift programming

init method simple example swift programming Example below shows use of init method. It is used for initialization of the structure,class or enumeration property. In swift, we must initialise the properties before using them. So either you can do it while declaring them if they are not going to change for all instances. In case,… Read More »

mutating method swift simple example – how to write ?

mutating method swift simple example – how to write ? Structure and enumeration are value type in swift. That means an instance method can not change its properties. For example a method within structure cannot change any variable defined within structure. To do so you need a method that is mutating – means changing the… Read More »

rawValue enum swift – what is rawValue ?

rawValue enum swift – what is rawValue ? It’s the value hold by name in enum. By default swift assigns enum value as zero and then incrementing by one. For accessing rawValue we can see example below: