The most common operation when using date(NSDate) objects in applications, it to convert them into string objects. So they can be properly formatted & shown to the user. Quite common is the reverse action as well; converting strings to date objects. Here’s a simple list of what else can be done when messaging with dates:

  • Compare dates
  • Calculates dates in the future or in the past, simply by using a reference date and adding or subtracting periods of time
  • Calculate date differences (e.g. find the elapsed time between two specific dates)
  • Break dates into components and access each date part separately(day, month etc)

Other classes releted to NSDate() are

About Swift

Swift is a new programming language for iOS, OS X, watchOS, and tvOS apps that builds on the best of C and Objective-C, without the constraints of C compatibility. Swift adopts safe programming patterns and adds modern features to make programming easier, more flexible, and more fun. Swift’s clean slate, backed by the mature and much-loved Cocoa and Cocoa Touch frameworks, is an opportunity to reimagine how software development works.
Swift has been years in the making. Apple laid the foundation for Swift by advancing our existing compiler, debugger, and framework infrastructure. We simplified memory management with Automatic Reference Counting (ARC). Our framework stack, built on the solid base of Foundation and Cocoa, has been modernized and standardized throughout. Objective-C itself has evolved to support blocks, collection literals, and modules, enabling framework adoption of modern language technologies without disruption. Thanks to this groundwork, we can now introduce a new language for the future of Apple software development.

Swift feels familiar to Objective-C developers. It adopts the readability of Objective-C’s named parameters and the power of Objective-C’s dynamic object model. It provides seamless access to existing Cocoa frameworks and mix-and-match interoperability with Objective-C code. Building from this common ground, Swift introduces many new features and unifies the procedural and object-oriented portions of the language.

Swift is friendly to new programmers. It is the first industrial-quality systems programming language that is as expressive and enjoyable as a scripting language. It supports playgrounds, an innovative feature that allows programmers to experiment with Swift code and see the results immediately, without the overhead of building and running an app.

Swift combines the best in modern language thinking with wisdom from the wider Apple engineering culture. The compiler is optimized for performance, and the language is optimized for development, without compromising on either. It’s designed to scale from “hello, world” to an entire operating system. All this makes Swift a sound future investment for developers and for Apple.

Swift is a fantastic way to write iOS, OS X, watchOS, and tvOS apps, and will continue to evolve with new features and capabilities. Our goals for Swift are ambitious. We can’t wait to see what you create with it.

Posted in IOS

Basics of swift

1. We can define variable either specifying datatypes or without specifying datatype.
a. Var string=”prem” //data type of variable is not defined
b. Var str: String=”Prakash”//defining data type of variable
Note: Must follow the camel case in variable naming, and first letter of key word must be start with capital letter
2. If syntax

Println(“My name is \(str))”

Output : My name is Prakash
3. For object

For object in[“Apple”, “Pear”, “Strawberry”]{

4. Single and multi-dimensional array
Single: var myArray=[“1”,”2”,”3”]
Multidimensional : var myArray=[“key”:”value”]
5. Let keyword is used to defining constants like let age=2
6. func keyword is used to prototyping the function
7. Class keyword is used to define class name
8. We can create an object as var objectname=classname()
Example of function
Type first

func addNumber(numberOne:Int,numberTwo:Int)->Int{
return numberOne+numbertwo}
addNumber(5,9)//function calling

type second(with label)

func fn(first a:Int, second b:int){
Where first and second is the label of parameters
fn(first: 3, second: 4) //calling function

Posted in IOS
Copyright © 2016 InfoxIT Portal. All rights reserved.
Seo wordpress plugin by www.seowizard.org.
Scroll To Top
Visit Us On FacebookVisit Us On Google PlusVisit Us On YoutubeCheck Our Feed