This file contains 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 UIKit | |
enum SafeRawRepresentable<Wrapped: RawRepresentable>: RawRepresentable { | |
case known(Wrapped) | |
case unknown(Wrapped.RawValue) | |
var rawValue: Wrapped.RawValue { | |
switch self { |
This file contains 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
// | |
// NibWrapperView.swift | |
// | |
// Created by Alek Åström on 2016-01-13. | |
// http://github.com/mralek | |
// | |
// Copyright © 2016 Alek Åström | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights |
This file contains 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 | |
enum Direction { | |
case Left, Right, Up, Down | |
var pointVector: CGPoint { | |
switch self { | |
case Left: return CGPoint(x: -1, y: 0) | |
case Right: return CGPoint(x: 1, y: 0) | |
case Up: return CGPoint(x: 0, y: -1) |
This file contains 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
func setupAnalytics() { | |
MasterViewController.self >> "Start" | |
AuthorViewController.self >> { "Author: \($0.author.name)" } | |
SettingsViewController.self >> "Settings" | |
OtherViewController.pageNameFunction<< // With currying! | |
} |
This file contains 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 UIKit | |
import QuartzCore | |
enum HairlineDirection: Int { | |
case Left, Right, Top, Bottom, None | |
init(point: CGPoint) { | |
if point.x < 0 { | |
self = Left |
This file contains 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
// | |
// Copyright (c) 2014 Alek Åström | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: | |
// |
This file contains 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
@interface RootViewController : UIViewController | |
// Child view controllers | |
@property (nonatomic) MenuViewController *menuViewController; // Hamburger menu | |
@property (nonatomic) UINavigationController *mainNavigationController; // Main UI | |
- (void)presentTutorial; // Or first time user registration, etc. Called from the app delegate. | |
@end |