Showing posts with label Mac. Show all posts
Showing posts with label Mac. Show all posts

Thursday, June 05, 2014

The Swift Programming Language - Lesson #3 - Dictionaries

In this lesson, you will learn how to create and use dictionaries in Swift.

Dictionaries

A dictionary is a collection of objects of the same type that is identified using a key. Consider the following example:

var platforms = [
    "Apple": "iOS",
    "Google" : "Android",
    "Microsoft" : "Windows Phone"

]

Here, platforms is a dictionary containing three items. Each item is a key/value pair. For example, "Apple" is the key that contains the value "iOS".

Unlike arrays, the ordering of items in a dictionary is not important. This is because an item is identified by the key and not the index. The above could also be written like this:

var platforms = [
    "Microsoft" : "Windows Phone",
    "Google" : "Android",
    "Apple""iOS"

]

The key of an item in a dictionary is not limited to String - it can be any of the hashable type (i.e. it must be uniquely representable). Th following example shows a dictionary using integer as its key:

var ranking = [
    1: "Gold",
    2: "Silver",
    3: "Bronze"

]

To access an item in a dictionary, specify its key:

let platform = platforms["Apple"]     // "iOS"

To know the number of items within a dictionary, use the count property:

var platformsCount = platforms.count  // 3

To replace the value of an item, specify its key and assign a value to it:

platforms["Microsoft"] = "WinPhone"

To remove an item from a dictionary, you can simply set it to nil:

platforms["Microsoft"] = nil;
platformsCount = platforms.count      // 2

The number of items inside the dictionary would now be reduced by one.

To insert a new item into the dictionary, you specify a new key and assign it a value, like this:


platforms["Samsung"] = "Tizen"

The value of a key can itself be another array as the following example shows:

var products = [
    platforms["Apple"]: ["iPhone", "iPad", "iPod touch"],
    platforms["Google"]: ["Nexus 3", "Nexus 4", "Nexus 5"],
    platforms["Microsoft"] : ["Lumia 920", "Lumia 1320","Lumia 1520"]

]

To access a particular product in the above example, you would first specify the key of the item you want to retrieve, followed by the index of the array, like this:

var product1 = products["Apple"][0]

Mutabilities of Dictionaries

When creating a dictionary, its mutability (its ability to change its size after it has been created) is dependent of you using either the let or var keyword. If you used the let keyword, the dictionary is immutable (its size cannot be changed after it has been created) as you are creating a constant. If you used the var keyword, the dictionary is mutable (its size can be changed after its creation) as you are now creating a variable.

See Also
Arrays

Thursday, December 19, 2013

Xamarin Course on 8-10 Jan 2014 Confirmed!

I am happy to announce that the MOB101 - Xamarin Course on 8-10 Jan 2014 is now confirmed!

Using the Xamarin Studio, you can now create compelling Android and iOS (iPhone and iPad) apps using C#. Best of all, you can share your application logic  between the two platforms. And when you are ready, you can easily port your application to Windows Phone 8 (using Visual Studio)! And did I mention that your app developed will be a native app and a first-class citizen on the platform?

On 8-10 Jan 2014, I will have the 3-day course on using Xamarin to build iOS and Android apps. This course covers both iOS and Android development. As such you need to bring along your own Mac, as the testing needs to be done on the iPhone Simulator, which requires a Mac.

For those of you who want to know about the power of Xamarin, check out my article on the Jan/Feb issue of Code Magazine!


Monday, June 24, 2013

Next Xamarin Course - 14-16 Aug 2013 (Wed to Fri)

A big thank you to those who attended the first Xamarin course! And to those of you who asked about the next run, I am happy to announce that the next run is scheduled to run on the 14-16 Aug 2013 (Wed to Fri).

Please note that for this course, you have to bring along a Mac as testing your iOS apps requires a Mac.

For course outline, please click here.

Key Highlights of the Course
* Learn how to write iOS apps using C# and Xamarin.iOS

* Learn how to write Android apps using C# and Xamarin.Android
* Learn how to share common code modules with your iOS and Android apps

You do not need prior knowledge of iOS and Android programming. You just need to know C#!


Venue
Bayview Hotel
30 Bencoolen Street
Singapore 189621

Date
14-16 Aug 2013 (Wed to Fri)

Time
9am to 5pm

Fee
S$1,495 (nett; GST N.A.)

Thursday, January 31, 2013

Training Roadmaps for Feb and Mar 2013 - Android, iOS, and Mac

Wondering what courses to take to prepare yourself for the explosion of the mobile market? Worry not, the following roadmaps will help guide you down the correct path.





For course brochures and application forms, please click here.
For course registrations, please email Wei-Meng Lee at weimenglee@learn2develop.net

Sunday, January 13, 2013

New Course - MAC103 - Using iPad to Create Stunning Keynote Presentation Slides


In this course, you will learn how to create your own award winning Keynote presentation slides, all from the comfortable of your iPad!  You will learn how to quickly create compelling presentation slides and incorporate multimedia elements into your presentation.

Topics


·       Exploring the Themes
o   White, Black, Gradient, Showroom, etc
·       Basics of Keynote
o   Changing Text color
o   Using Text
o   Importing Graphics
o   Notes
·       Working With Media
o   Working with Images
o   Drawing Objects
o   Layering Graphics Objects
o   Exporting Keynote to PDF, PPT, etc
o   Movie
o   Animations
·       Working with Tables
·       Displaying Charts
·       Builds and Transitions
·       Creating your own Themes
·       Using Remote Control to control your presentation

·       
Duration
·              9am to 5pm

Fee
·              S$599 per pax

Date
·              15 Feb 2013 (Fri)

For this course, you would need to bring along your own iPad / iPad mini.