check nsuserdefault

func userAlreadyExist(key: String) -> Bool {
return NSUserDefaults.standardUserDefaults().objectForKey(key) != nil

Change hight of tabbar custom

add more extension:

extension UITabBar {

override public func sizeThatFits(size: CGSize) -> CGSize {
var sizeThatFits = super.sizeThatFits(size)
sizeThatFits.height = 90
return sizeThatFits

disable swipe to delete on tableview swift

override func tableView(tableView: UITableView, editingStyleForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCellEditingStyle {
if (self.tableView.editing) {
return UITableViewCellEditingStyle.Delete
return UITableViewCellEditingStyle.None

Alamofire No Such Module (CocoaPod)

Alamofire No Such Module (CocoaPod)

up vote
down vote
working this:

Scheme -> Manage Schemes...

checked Alamofire checkbox → Build Alamofire scheme
and, if you used Playground , you should change settings Playground:

View -> Utilities -> Show File Inspector

Platform OSX → iOS

encode url with swift

var escapedString = originalString.stringByAddingPercentEncodingWithAllowedCharacters(.URLHostAllowedCharacterSet())

or api = api.stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLQueryAllowedCharacterSet())

Callback is called best is

var selectionCallback: (()->Void)?
if let selectionCallback = self.selectionCallback{

selectionCallback = {

set hight for row table view

self.tableView.rowHeight = 79.f;

add mapkit to viewcontroller

Go to Plist file add : NSLocationWhenInUseUsageDescription == "Hey Due"

create func: func setupMap() {
locationMgr.delegate = self

// get location

locationMgr.desiredAccuracy = kCLLocationAccuracyBest

makit.showsUserLocation = true

and delegate:

Note When set rootViewController

Note When set rootViewController

let navi = UINavigationController(rootViewController: (view as! KYDrawerController))
app?.window?.rootViewController = navi

How do I force the Trash to empty on El Captan?

sudo rm -rf ~/.Trash /Volumes/*/.Trashes


Subscribe to Trần Mạnh Hoàng RSS