Skip to content

Instantly share code, notes, and snippets.

View lawreyios's full-sized avatar
🎯
Focusing

Lawrence Tan lawreyios

🎯
Focusing
View GitHub Profile
@lawreyios
lawreyios / uitextfieldwithpadding
Last active December 17, 2018 15:39
Add padding to UITextField - Swift 3.0
class CustomSearchTextField: UITextField {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override func textRect(forBounds bounds: CGRect) -> CGRect {
return UIEdgeInsetsInsetRect(bounds, UIEdgeInsetsMake(0, 15, 0, 15))
}
override func placeholderRect(forBounds bounds: CGRect) -> CGRect {
//: Playground for : https://medium.com/@lawrey/swiftytutorial-map-properties-of-2-arrays-9da34c5e279d
import Foundation
enum CardType {
case debit
case credit
}
struct Bank {
@lawreyios
lawreyios / swiftyinfo-arc-1
Last active July 22, 2017 02:30
#SwiftyInfo — What in the world is ARC? — Part 1
class Person {
let name: String
init(name: String) {
self.name = name
}
}
let person1 = Person(name: "John")
var person2 = Person(name: "Doe")
@lawreyios
lawreyios / swiftyinfo-arc-2
Last active July 22, 2017 02:23
#SwiftyInfo — What in the world is ARC? — Part 1
class Person {
let name: String
init?(name: String) {
self.name = name
}
}
let person1 = Person(name: "John")
@lawreyios
lawreyios / swiftyinfo-arc-3
Last active July 22, 2017 02:29
#SwiftyInfo — What in the world is ARC? — Part 1
class Person {
let name: String
init(name: String) {
self.name = name
}
}
var person1: Person? = Person(name: "John")
import UIKit
enum StartingPoint {
case Left
case Right
}
typealias Mask = UIImage
typealias MaskView = UIImageView
class FMViewController: UIViewController {
@IBOutlet weak var qnImageView: UIImageView!
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
fadeInQuestion1()
}
import Foundation
import UIKit
//MARK: Round 1
let qn1 = "qn1"
let ans1 = "ans1"
extension FMViewController {
func round1() {
//: Playground - noun: a place where people can play
import UIKit
class Developer {
var name: String?
init(name: String) {
self.name = name
}
//: Playground - noun: a place where people can play
import UIKit
protocol ReusableView: class {}
extension ReusableView where Self: UIView {
static var reuseIdentifier: String {
return String(describing: self)
}