Skip to content

Instantly share code, notes, and snippets.

class ViewController: UIViewController {
@IBOutlet weak var emailTF: UnderlinedTextField!
@IBOutlet weak var passwordTF: UnderlinedTextField!
@IBOutlet weak var backgroundSV: UIScrollView!
static func storyboardInstance() -> Solution3VC? {
let storyboard = UIStoryboard(name: Storyboard.main ,bundle: nil)
return storyboard.instantiateViewController(withIdentifier: "Solution3VC") as? Solution3VC
}
@manismku
manismku / System Design.md
Created January 20, 2019 14:22 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@manismku
manismku / lldb-debugging.md
Created January 19, 2019 15:53 — forked from alanzeino/lldb-debugging.md
LLDB debugging with examples

LLDB Debugging Cheat Sheet

Commands

LLDB Commands

LLDB comes with a great set of commands for powerful debugging.

help

Your starting point for anything. Type help to get a list of all commands, plus any user installed ones. Type 'help for more information on a command. Type help to get help for a specific option in a command too.

class LLNode {
var data: Int
var next: LLNode?
init(value: Int) {
self.data = value
}
}
func reversePairs(node: LLNode?) {
class LLNode {
var data: Int
var next: LLNode?
init(value: Int) {
self.data = value
}
}
func reversePairRecursion(node: LLNode?) -> LLNode? {
@manismku
manismku / Dateformatter.swift
Created December 21, 2018 15:12
Dateformatter Enums
enum DNPDateFormatter {
case humanDay
case time
func info(_ forDate: Date) -> String {
return formatters().string(from: forDate)
}
private func formatters() -> DateFormatter {
// MARK: - Pan
typealias HandlePanGesture = MSAlertController
extension HandlePanGesture: UIGestureRecognizerDelegate {
@objc func handlePan(sender: UIPanGestureRecognizer) {
switch sender.state {
case .began:
startLocation = sender.location(in: view)
if let direction = sender.direction {
if animator?.currentState == .closed {
if direction == .left {
func finalState() -> (() -> Void) {
return { [weak self] in
if let weakSelf = self {
weakSelf.alertView.textIndicator.alpha = 0.0
weakSelf.sideView.alpha = 1.0
weakSelf.alertView.headerTitle.alpha = 0
weakSelf.cancelBttn.alpha = 0
}
}
}
// Alertview state
enum State {
case closed
case open
}
extension State {
var opposite: State {
switch self {
case .open: return .closed
func addGesture() {
let pan = InstantPanGestureRecognizer(target: self, action: #selector(handlePan))
pan.delegate = self
alertView.addGestureRecognizer(pan)
}