Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

swift check if class is of type

class Animal {}
class Dog : Animal {}
class Cat : Animal {}

let c = Cat()

c is Dog // false
c is Cat // true
c is Animal // true

// In Swift => 3:
type(of: c) == Cat.self // true
type(of: c) == Animal.self // false

// In Swift 2:
c.dynamicType == Cat.self // true
c.dynamicType == Animal.self // false
Comment

PREVIOUS NEXT
Code Example
Swift :: Associate Multiple Values Swift 
Swift :: func collectionview 
Swift :: swift chuck array in peases 
Swift :: function parameters swift 
Swift :: Create a Set in Swift 
Swift :: Swift Things to Remember About Swift Range 
Swift :: Function Return Types in swift 
Swift :: swift methods 
Swift :: selenium lfor loops 
Swift :: protocol oriented programming 
Swift :: ios uikit hide/show keyboard if scrolling 
Swift :: Swift Add Elements to a Set 
Swift :: bind object 
Swift :: Swift Create Multiple Objects of Class 
Swift :: swift array to data 
Swift :: meu eclipse não gera a implementação do mapstruct 
Ruby :: ruby array group by attribute 
Ruby :: rails image tag 
Ruby :: getting wanked off by ruby 
Ruby :: ruby gem dir 
Ruby :: rails difference in minutes between 2 datetime 
Ruby :: require relative ruby 
Ruby :: ruby raise argumenterror 
Ruby :: new date ruby 
Ruby :: ruby array unshift 
Ruby :: contain .where rails 
Ruby :: ruby array randomly display 
Ruby :: ruby rails delete all of a model in console 
Ruby :: DEPRECATION WARNING: Sprockets method `register_engine` is deprecated. 
Ruby :: ruby if statement multiple conditions 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =