This file contains hidden or 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
import Foundation | |
import CoreFoundation | |
// MARK: Without recursion | |
func fib(_ n: Int) -> Int { | |
guard n > 1 else { return n } | |
var arr = Array.init(repeating: 1, count: n) | |
for i in 2..<n { | |
arr[i] = arr[i - 1] + arr[i - 2] | |
} |
This file contains hidden or 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 CustomPageControl: UIPageControl { | |
// active and inactive images | |
let imgActive: UIImage = #imageLiteral(resourceName: "activeImage").withRenderingMode(.alwaysTemplate) | |
let imgInactive: UIImage = #imageLiteral(resourceName: "inactiveImage") | |
// adjust these parameters for specific case | |
let customActiveYOffset: CGFloat = 5.0 | |
let customInactiveYOffset: CGFloat = 3.0 | |
var hasCustomTintColor: Bool = false | |
let customActiveDotColor: UIColor = UIColor(rgb: 0xe62f3e, alphaVal: 1.0) |
This file contains hidden or 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
import UIKit | |
class LargeTitleCustomOffset: UINavigationBar { | |
let labelcolor = UIColor(red: 36.0/255.0, green: 38.0/255.0, blue: 47.0/255.0, alpha: 1.0) | |
override func draw(_ rect: CGRect) { | |
super.draw(rect) | |
self.backgroundColor = UIColor.white |