Skip to content

Instantly share code, notes, and snippets.

View vialyx's full-sized avatar
🎯
Focusing

Maxim Vialyx vialyx

🎯
Focusing
View GitHub Profile
class VideoPlayer: Player {
var file: String
var width: Int
var height: Int
}
// PUT code into playground
var globalVariable = "globalString"
func fly() {
var localVariable = "localString"
}
struct Airplane {
// Local Variable
var number: String
struct PropertyStructM {
static func typeMethod() {
// Code
}
}
PropertyStructM.typeMethod()
struct NameComponents {
var firstName: String
var lastName: String
mutating func change(firstName: String, lastName: String) {
self.firstName = firstName
self.lastName = lastName
}
class Player {
var playing: Bool = false
func play() {
playing = true
}
func stop() {
playing = false
struct PropertyStruct {
static var storedTypeProperty = "1"
static var computedTypeProperty: Double {
return 10.0
}
}
print("struct type property: \(PropertyStruct.storedTypeProperty)")
struct Pin {
var value: String {
willSet {
print("new pin value: \(newValue)")
}
didSet {
print("old pint value: \(oldValue)")
}
}
struct Payment {
var amount: Float
var comission: Float
var totalAmount: Float {
return amount + comission
}
}
extension UIView {
var cornerRadius: CGFloat {
set {
layer.cornerRadius = newValue
}
get {
return layer.cornerRadius
}
}
class EpayBillingProcessor {
var view: UIView?
private lazy var innerView: UIView? = { [unowned self] in
guard let `view` = view else {
return UIView(frame: .zero)
}
return view
}()