How to use Swift classes all across an Objective-C project

The most universal solution is to change SWIFT_OBJC_INTERFACE_HEADER_NAME (“Objective-C Generated Interface Header Name”) under Project’s, not Targets, Build Settings, to: $(PROJECT_NAME)-Swift.h — one per project; $(SWIFT_MODULE_NAME)-Swift.h — one per module (default value). Then import the Project Header, example: #import MyProjectName-Swift.h

Sizes of iPhone UI Elements

Taken from idev101 more in: iPhone Development 101: User Interface: Sizes of iPhone UI Elements How to detect the current device size and kind Element iPhone 4S (and earlier) iPhone 5 iPhone 6 & 7 iPhone 6 Plus & 7 Plus Window (including status bar area) 320 x 480 pts 320 […]

Vary for Traits in Xcode 8

Vary for Traits in Xcode 8 The UI to select the size classes has changed in xcode 8. Now it is as follows: Any constraints that you add without selecting Vary for Traits options will be considered as for all the size classes( Any Any previously) To add a constraint […]

How to debug deep linking in iOS

What is deep linking? Deep linking basically enables you to open an app from another app or a website while passing on parameters. This mechanism works with custom URL schemes which you can define in the .plist of your app. Why deep linking? If you have an app with lookup functionality […]

Sending an HTTP POST request on iOS

The following code describes a simple example using POST method.(How one can pass data by POST method) You can use the following code snippet, as described in this article: Here, I describe how one can use of POST method. 1. Set post string with actual username and password. NSString *post […]

iOS Singletons – Objective-C

A singleton is a special kind of class where only one instance of the class exists for the current process. (In the case of an iOS app, the one instance is shared across the entire app.) Some examples in UIKit are [UIApplication sharedApplication] (which returns the sole instance of the application […]

Show animation when addsubview

If you want to add a subview with animation, try this simple snippet: PS: Replace myView with the name of the view you want to replace. CATransition *applicationLoadViewIn =[CATransition animation]; [applicationLoadViewIn setDuration:duration]; [applicationLoadViewIn setType:kCATransitionReveal]; [applicationLoadViewIn setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]]; [[myView layer]addAnimation:applicationLoadViewIn forKey:kCATransitionReveal];

NSOperation – Tutorial

Operation Queues GCD is a low-level C API that enables developers to execute tasks concurrently. Operation queues, on the other hand, are high level abstraction of the queue model, and is built on top of GCD. That means you can execute tasks concurrently just like GCD, but in an object-oriented […]

UIAlertView in Swift

In Swift and iOS 8 SDK you can present an alert view as shown in the code below :   var alert = UIAlertController(title: “Alert Title”, message: “Message”, preferredStyle: UIAlertControllerStyle.Alert)alert.addAction(UIAlertAction(title: “OK”, style: UIAlertActionStyle.Default, handler: nil)) self.presentViewController(alert, animated: true, completion: nil) You can also add destructive and cancel actions by setting […]


IBAction and Outlets

Actions An action is a piece of code that’s linked to some kind of event that can occur in your app. When that event takes place, the code gets executed. You can define an action to accomplish anything from manipulating a piece of data to updating the user interface. You […]