UrbanPro
true

Learn Mobile App Development from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Swift Constants

Satish S
13/12/2016 0 0

Objective C Provides  a way to declare constant using Const keyword.
In Objective C we often use #define for declaring a macro.
Swift the way to declare constants is different from objective C.

Let is used to declare a constant in Swift Language.
 
let a: String="hello World!"
 
Let tells the compiler that 'a' is the name of the variable which is constant Constant.
String tell the type of the constant that a stores.
Declaring constants and using then is similar to using immutable classes like NSString,NSArray etc.
NSString *a=@"hello World!"
In the above line a is pointer to NSString address which is Immutable i.e whose address content cant be changed.
Let me describe the difference between using const * and *const pointers.
 
int a = 10; int b = 15; 
int *const ptr = &a;
*ptr = 20; // OK. a is now 20.
ptr = &b; // Error, ptr is a constant.
 
The above declaration should be read from left to right. The above code declares a const pointer to int.
Pointer ptr can't be made to point do different variable.
0 Dislike
Follow 0

Please Enter a comment

Submit

Other Lessons for You

How to Make an Awesome Image Classifier With Tensorflow in iOS in less than 5 minutes.
What is TensorFlow? Tensorflow is an Open source machine learning framework. Its a library for doing Complex Numerical Computation to build machine learning models from scratch. TensorFlow is cross-platform....

The Future of Mobile App Development
It is a not a big surprise to know that about 179 billion mobile applications are downloaded per year. This big figure indicates about the future of mobile apps .It is a fast growing sector. Like other...

Xamarin Evolve 2016
Xamarin is one of the best cross-platform frameworks I have ever seen in my life. That is the biggest sell, you can write 1 mobile app and then “tailor” it for 3 different platforms. Great....

Learning Path For Mobile Application Development
I. Traditional Approach: 1. Native Android Application Development: Android is a mobile operating system that runs on phones, tablets, smartwatches, TVs and more. You can learn Android Application Development...

What Are IT Industries Performance Metrics?
1. Outstanding Expectation: Eligible to get Promotion easily and good salary hike. Always preferrable to go abroad. 2. Exceed Expectation: Can get Promotion as per schedule of company with good salary...
X

Looking for Mobile App Development Classes?

The best tutors for Mobile App Development Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn Mobile App Development with the Best Tutors

The best Tutors for Mobile App Development Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more