Swift performSelector:withObject:afterDelay: is unavailable [duplicate]

Swift 4 DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { // your function here } Swift 3 DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(0.1)) { // your function here } Swift 2 let dispatchTime: dispatch_time_t = dispatch_time(DISPATCH_TIME_NOW, Int64(0.1 * Double(NSEC_PER_SEC))) dispatch_after(dispatchTime, dispatch_get_main_queue(), { // your function here })

How to create an Empty Application in Xcode without Storyboard

There is no option in XCode6 and above versions for directly creating an Empty Application as in XCode5 and earlier. But still we can create an application without Storyboard by following these steps: Create a Single View Application. Remove Main.storyboard and LaunchScreen.xib (select them, right-click, and choose to either remove them from the project, or … Read more

unable to dequeue a cell with identifier Cell – must register a nib or a class for the identifier or connect a prototype cell in a storyboard

You can register a class for your UITableViewCell like this: With Swift 3+: self.tableView.register(UITableViewCell.self, forCellReuseIdentifier: “cell”) With Swift 2.2: self.tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: “cell”) Make sure same identifier “cell” is also copied at your storyboard’s UITableViewCell. “self” is for getting the class use the class name followed by .self.

Xcode Storyboard warning: Constraint referencing items turned off in current configuration. Turn off this constraint in the current configuration

This warning can be annoying and happens as of Xcode 6.1.1. The main problem is that you can not easily find the referenced constraint by clicking on the warning. I guess this is a bug and will get fixed sooner or later. However, in the meantime you can use this little workaround: Step 1: Detect … Read more

NSDate Comparison using Swift

If you want to support ==, <, >, <=, or >= for NSDates, you just have to declare this somewhere: public func ==(lhs: NSDate, rhs: NSDate) -> Bool { return lhs === rhs || lhs.compare(rhs) == .OrderedSame } public func <(lhs: NSDate, rhs: NSDate) -> Bool { return lhs.compare(rhs) == .OrderedAscending } extension NSDate: Comparable … Read more

Autoresizing issue of UICollectionViewCell contentView’s frame in Storyboard prototype cell (Xcode 6, iOS 8 SDK) happens when running on iOS 7 only

contentView is broken. It can be also fixed in awakeFromNib ObjC: – (void)awakeFromNib { [super awakeFromNib]; self.contentView.frame = self.bounds; self.contentView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; } Swift3: override func awakeFromNib() { super.awakeFromNib() self.contentView.frame = self.bounds self.contentView.autoresizingMask = [.flexibleWidth, .flexibleHeight] }

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)