Skip to content

Instantly share code, notes, and snippets.

@tfrank64
tfrank64 / AppDelegate.swift
Created June 8, 2014 17:32
Swift UITabBar Programmatically
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {
// Override point for customization after application launch.
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
var nav1 = UINavigationController()
var first = FirstViewController(nibName: nil, bundle: nil)
nav1.viewControllers = [first]
var second = SecondViewController(nibName: nil, bundle: nil)
var nav2 = UINavigationController()
@yuhua-chen
yuhua-chen / Drag-and-drop-uitableviewcell-swift2.swift
Created August 6, 2015 09:12
Demo the drag and drop UITableViewCell in Swift 2.
struct Drag {
static var placeholderView: UIView!
static var sourceIndexPath: NSIndexPath!
}
func handleLongPress(gesture: UILongPressGestureRecognizer) {
let point = gesture.locationInView(tableView)
let indexPath = tableView.indexPathForRowAtPoint(point)
switch gesture.state {