This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HTMLElement { | |
... | |
lazy var asHTML: () -> String = { [weak self] in | |
guard let htmlElement = self else { return "" } | |
return "<\(htmlElement.name)>\(htmlElement.text)</\(htmlElement.name)>" | |
} | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person { | |
let name: String | |
var apartment: Apartment? | |
init(name: String) { | |
self.name = name | |
} | |
deinit { | |
print("\(name) is being deinitialized") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person { | |
let name: String | |
init(name: String) { | |
self.name = name | |
} | |
deinit { | |
print("\(name) is being deinitialized") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person { | |
let name: String | |
init(name: String) { | |
self.name = name | |
} | |
deinit { | |
print("\(name) is being deinitialized") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
TextViewWithPlaceholderAndExpandingHeight.swift | |
TextViewWithPlaceholderAndExpandingHeight | |
Created by Shabib Hossain on 1/24/17. | |
Copyright (c) 2017 shabib87 <shabib.sust@gmail.com> | |
Permission is hereby granted, free of charge, to any person obtaining a copy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum BiriyaniType { | |
case veg | |
case nonveg | |
} | |
class Biriyani { | |
let count: Int | |
let size: OrderSize | |
let spiceRange: SpiceRange | |
let type: BiriyaniType |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Biriyani { | |
let count: Int | |
let size: OrderSize | |
let spiceRange: SpiceRange | |
let type: BiriyaniType | |
init (count: Int = 1, size: OrderSize = .medium, spiceRange: SpiceRange = .spicy, type: BiriyaniType = .nonveg) { | |
self.count = count | |
self.size = size | |
self.spiceRange = spiceRange |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Biriyani { | |
let count: Int | |
let size: OrderSize | |
let spiceRange: SpiceRange | |
init (count: Int, size: OrderSize, spiceRange: SpiceRange) { | |
self.count = count | |
self.size = size | |
self.spiceRange = spiceRange | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum OrderSize { | |
case small | |
case medium | |
case large | |
} | |
enum SpiceRange { | |
case spicy | |
case hot | |
case extraHot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User { | |
var name = "" | |
var age = 0 | |
} | |
class EditUserInfoController { | |
var user: User | |
init (user: User) { | |
self.user = user |