Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

Swift Enumeration

// define enum 
enum Season {
  
  // define enum values
  case spring, summer, autumn, winter
}

// create enum variable
var currentSeason: Season

// assign value to enum variable
currentSeason = Season.summer

print("Current Season:", currentSeason)
Comment

Enumerations in swift

// MARK: Enumerations used in swift

let result = "failure"
let result2 = "failed"
let result3 = "fail"
enum Result {
    case success
    case failure
}
let res = Result.failure
print(res)
Comment

PREVIOUS NEXT
Code Example
Swift :: while loop swift 
Swift :: swift toggle on change 
Swift :: UICollectionviewcontroller reload data 
Swift :: cifilter image preserve orientation 
Swift :: .next() enum swift 
Ruby :: rails create database only in test 
Ruby :: base64 decode ruby 
Ruby :: ruby variable in string 
Ruby :: find records created in a particular month rails 
Ruby :: create table if not exist rails 
Ruby :: array ruby taking 3 last value 
Ruby :: ruby is int 
Ruby :: ruby if dates is in range 
Ruby :: rails difference in minutes between 2 datetime 
Ruby :: ruby randomize array 
Ruby :: ruby array to string with commas 
Ruby :: rspec shared examples 
Ruby :: rails redirect_to with params 
Ruby :: ruby default method parameters 
Ruby :: times ruby 
Ruby :: rails scope syntax 
Ruby :: ruby pry syntax 
Ruby :: rails console destroy all 
Ruby :: validations rails integer suprior to 0 
Ruby :: ruby loop over files in a folder 
Ruby :: how to remove last element from array in ruby 
Ruby :: check if the substring is present in the column of the record rails console 
Ruby :: text_field_tag transfer params rails 
Ruby :: <= operator in rails 
Ruby :: common functions in rails 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =