Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

swift make enum inspectable

// There is no way to do this. But there is a little workaround.

// Swift 5:
public enum Size: String {
  case small = "small"
  case medium = "medium"
  case large = "large"
}

class SizeView: UIView {
  private var size: Size = .large

  @IBInspectable 
  public var sizeName: String = "large" {
    didSet {
      guard self.sizeName != oldValue else { return }
      self.size = Size(rawValue: self.sizeName)
    }
  }
}
Comment

PREVIOUS NEXT
Code Example
Swift :: swift enum nib 
Swift :: swift get keys from dictionary 
Swift :: swiftui rounded specific corner 
Swift :: swift ui view 
Swift :: Convert JSON to Data 
Swift :: Swift Variable names cannot start with numbers 
Swift :: how to send a file from file manager in mail swift 
Swift :: swift go to main thread 
Swift :: send receive udp swift 
Swift :: Swift for Loop with where Clause 
Swift :: Swift Change Value of Dictionary 
Swift :: Swift Autoclosure 
Swift :: get parent view controller in presentation mode swift 
Swift :: Swift guard Statement Inside a Function 
Swift :: Swift Code Reusability 
Swift :: how to print body moya swift 
Swift :: how to have diffrent size images in a stack view swift 
Swift :: Function Return Types in swift 
Swift :: Swift enum Associated Values 
Swift :: ios uikit hide/show keyboard if scrolling 
Swift :: secure password field in textfield swift 
Swift :: swift convert frame to another view 
Swift :: swift ge array item from indexset 
Ruby :: 2 decimal places ruby 
Ruby :: rails prepare testing db 
Ruby :: drop rails all db 
Ruby :: post request rails link_to 
Ruby :: rails find_by order 
Ruby :: ruby how to loop through an array 
Ruby :: ruby downcase 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =