Skip to content

Instantly share code, notes, and snippets.

View oaleeapp's full-sized avatar

Victor Lee oaleeapp

View GitHub Profile
@oaleeapp
oaleeapp / transparentNavBar.swift
Created April 23, 2020 12:15
Transparent Nav Bar
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
let navigationBar = self.navigationController?.navigationBar
navigationBar?.tintColor = UIColor.ColorTheme.defaultTheme.backgroundColor
navigationBar?.setBackgroundImage(UIImage(), for: .default)
navigationBar?.shadowImage = UIImage()
navigationBar?.isTranslucent = true
navigationBar?.backgroundColor = .clear
}
import Foundation
extension Dictionary {
mutating public func setValue(value: Any, forKeyPath keyPath: String) {
var keys = keyPath.components(separatedBy: ".")
guard let first = keys.first as? Key else { print("Unable to use string as key on type: \(Key.self)"); return }
keys.remove(at: 0)
if keys.isEmpty, let settable = value as? Value {
self[first] = settable
} else {
@oaleeapp
oaleeapp / ViewController.swift
Created May 6, 2019 02:07
Set up TextFields
class ViewController {
@IBOutlet weak var emailTextField: OyaRoundCornerTextField!
@IBOutlet weak var passwordTextField: OyaRoundCornerTextField!
// ...
var textFields: [UITextField] {
get {
@oaleeapp
oaleeapp / ViewController.swift
Last active May 6, 2019 02:05
Keyboard Extention
class ViewController {
@IBOutlet weak var scrollView: UIScrollView!
// ...
}
extension ViewController {
func registerKeyboardNotifications() {
@oaleeapp
oaleeapp / .sh
Created September 14, 2018 04:07
Xcode build phases run script for update GraphQL APIs
# move .graphql files to ${SRCROOT}/ProjectName/GraphQL/
# move schema.json to ${SRCROOT}/ProjectName/GraphQL/schema.json
# move GraphQLAPIs.swift to ${SRCROOT}/ProjectName/Models/GraphQLAPIs.swift
npm install -g aws-appsync-codegen
aws-appsync-codegen generate "${SRCROOT}/ProjectName/GraphQL/"*.graphql --schema ${SRCROOT}/ProjectName/GraphQL/schema.json --output ${SRCROOT}/ProjectName/Models/GraphQLAPIs.swift
# output file ${SRCROOT}/ProjectName/Models/GraphQLAPIs.swift will be updated after build
@oaleeapp
oaleeapp / embedVideo.swift
Created August 7, 2018 06:45
Embed Youtube video into UIWebView
// let videoLink = "https://www.youtube.com/watch?v=[your-video-id]"
if let videoId = URLComponents(string: videoLink)?.queryItems?.first(where: { $0.name == "v" })?.value {
let videoWebView = UIWebView(frame: self.videoContainerView.bounds)
videoWebView.allowsInlineMediaPlayback = true
videoWebView.autoresizesSubviews = true
videoWebView.scrollView.bounces = false
Verifying my Blockstack ID is secured with the address 18vwJJzJH3ompdsFyLbYeGoDAiKK33FY6z https://explorer.blockstack.org/address/18vwJJzJH3ompdsFyLbYeGoDAiKK33FY6z
04701fc449ad45ca8021126385e675190b15355b2f625e7f2df9b9bbbb756a5f90af56ddb980f2825d6b133dc5195c2b7087c94221561286556f082fe81dbe2219;davidleeplaysmart
//: Playground - noun: a place where people can play
import UIKit
class 房子 {
enum 房間 {
case 臥室
case 客廳
case 廚房
@oaleeapp
oaleeapp / DynamicWorld
Created January 20, 2017 19:05
A example of UIDynamic Classes
import UIKit
import PlaygroundSupport
class physicViewController : UIViewController {
lazy var dynamicAnimator: UIDynamicAnimator = {