line center string

import AOR
"StrikethroughStyle StyleSingle\n", .Line(LineInfo(.Strikethrough, nil, .Single, .Solid, false)))

Not use reloadData when delete row

tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.Fade)
self.t -= 1

override func viewWillAppear(animated: Bool) {
self.navigationController?.navigationBarHidden = true

//Status bar style and visibility
UIApplication.sharedApplication().statusBarHidden = false
UIApplication.sharedApplication().statusBarStyle = .LightContent

//Change status bar color
let statusBar: UIView = UIApplication.sharedApplication().valueForKey("statusBar") as! UIView
if statusBar.respondsToSelector("setBackgroundColor:") {
statusBar.backgroundColor = UIColor.redColor()


setStatusBarHidden(_:withAnimation:) deprecated in iOS 9

class ViewController: UIViewController {
var isHidden:Bool = false
@IBAction func clicked(sender: AnyObject) {
isHidden = !isHidden
UIView.animateWithDuration(0.5) { () -> Void in
override func preferredStatusBarUpdateAnimation() -> UIStatusBarAnimation {
return UIStatusBarAnimation.Slide
override func prefersStatusBarHidden() -> Bool {
return isHidden

#if... in swift

Go to your project / select your target / Build Settings / search for Custom Flags
For your chosen target set your custom flag using -D prefix (without white spaces), for both Debug and Release
Do above steps for every target you have
Here's how you check for target:

push notification DEV && APPS
Development Phase:

Step 1: Create Certificate .pem from Certificate .p12
Command: openssl pkcs12 -clcerts -nokeys -out apns-dev-cert.pem -in apns-dev-cert.p12

Step 2: Create Key .pem from Key .p12
Command : openssl pkcs12 -nocerts -out apns-dev-key.pem -in apns-dev-key.p12

nit NSManagedObject

init is not a designated initializer for NSManagedObject

resize image before upload swift

extension UIImage {
var uncompressedPNGData: NSData { return UIImagePNGRepresentation(self)! }
var highestQualityJPEGNSData: NSData { return UIImageJPEGRepresentation(self, 1.0)! }
var highQualityJPEGNSData: NSData { return UIImageJPEGRepresentation(self, 0.75)! }
var mediumQualityJPEGNSData: NSData { return UIImageJPEGRepresentation(self, 0.5)! }
var lowQualityJPEGNSData: NSData { return UIImageJPEGRepresentation(self, 0.25)! }

Change tab bar item badge from other ViewController ios

let tabArray = self.tabBarController?.tabBar.items as NSArray!
let tabItem = tabArray.objectAtIndex(2) as! UITabBarItem
tabItem.badgeValue = "10"

shortcut xcode cool


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