Skip to content

Instantly share code, notes, and snippets.

View mickspecial's full-sized avatar

Michael mickspecial

View GitHub Profile
class MainTabBarController: UITabBarController {
let mainCoordinator = MainCoordinator()
var home: BreathingVC!
var settings: SettingsVC!
var presets: PresetsTVC!
var breathSettings: BreathSettingVC!
override func viewDidLoad() {
super.viewDidLoad()
@mickspecial
mickspecial / Toast.swift
Created March 5, 2019 04:57
Toast alert for Swift
final class Toast {
private var parentView: UIView!
private var hideAfter: TimeInterval!
private var toastLabel: UILabel = {
let label = UILabel()
label.textColor = UIColor.black
label.numberOfLines = 0
enum AttendanceType: Int {
case paid, free, reset
}
extension Collection where Element == AttendanceType {
var itemSort: [Int] {
@mickspecial
mickspecial / justInfo.swift
Created January 27, 2019 00:54
Tableview and Cell Helpers
// No Storyboards
// Some reasons why
// https://www.youtube.com/watch?v=bd2KSWLXo3A
// https://www.youtube.com/watch?v=U1Ub-LFIqfA
// https://www.youtube.com/watch?v=g6yz5oX5iWc
// note - was was a huge fan of SB's - but gave this approach a try... never looked back
@mickspecial
mickspecial / CustomBarButton.swift
Last active January 21, 2019 12:14
Custom Back Button
import UIKit
// Use it...
/*
let bb = CustomBarButton(image: #imageLiteral(resourceName: "leftWhiteChevron"))
bb.addTarget(self, action: #selector(backAction), for: .touchUpInside)
navigationItem.leftBarButtonItem = UIBarButtonItem(customView: bb)
*/
@mickspecial
mickspecial / CircleButton.swift
Created January 20, 2019 00:34
Custom Circle Button
class CircleButton: UIControl {
// Mods
private var fontSize: CGFloat!
private var circleDiameter: CGFloat!
enum LabelPostition {
case topLeft, bottomLeft, topRight, bottomRight, left, right, top, bottom
}