Monthly Archives:October 2017

Adding a repository to GitHub Desktop

A repository that I made on GitHub from browser didn’t show up on GitHub Desktop version. A posting on Stack Overflow shows how to add a repo onto GitHub Desktop.

Brian Moriguchi

Using GitHub with Xcode 8

A couple of GitHub tutorial videos that I watched:

Connect to GitHub with Xcode 8

Uploading an Existing Xcode 8 project to GitHub

Brian Moriguchi Swift 101 – Classes, Variables, Properties & Methods Daily Tips once published Swift introductory tutorials. This excerpt is about Classes, Variables, Properties & Methods. I’ve seen and read about exactly the same thing for few times in the past six months, but now everything looks simple and easy:

Defining Classes in Swift


In Swift, classes are defined in a single .swift source code file as compared to Objective-C, where classes are defined in two separate files, a header (.h) file and an implementation (.m) file.

Declaring Variables



In Objective-C you can declare instance variables at the class level and local variables within methods. In Swift, there are no class-level variables—only local variables that you declare within methods. However, you can declare properties at the class level (see the Declaring Properties section below.)

Declaring Simple Properties


In Objective-C, properties typically had backing instance variables in which the actual value of the property was stored. Swift simplifies properties by unifying the concepts of properties and instance variables. Properties no longer have a backing instance variable. Everything about a property is declared in a single location.

Declaring Computed Properties

Swift also has computed properties that have associated get and set methods.


In this example, the Thermometer class has a simple temperatureFahrenheit property and a computedtemperateCelsius property.

Notice that the get and set methods of the Thermometer class do not reference an instance variable, because there is no such thing as an instance variable in Swift!

In this case, the get method retrieves the value from the temperatureFahrenheit property, converts it to Celsius and returns the value. The set method takes the value passed to it, converts it to Fahrenheit and then stores the result in the temperatureFahrenheit property.

The value passed to the property’s set method is stored in an implicitly named parameter called newValue. If you want to use a different parameter name, you can specify the name in parentheses after the set as shown in the following code:


Declaring Methods


To declare a method, you first specify the func keyword, followed by the name of the method. If the method has parameters, you include them in the parentheses. For each parameter, you specify the name of the parameter followed by a colon, followed by its type. If the method has a return value, you then add a hyphen and greater than sign (->) followed by the type of the return value.

The following code contains an example of a method that accepts no parameters and returns nothing:


Initializer Methods

Initializer example:




Multiple initializer example:


In this example, both methods are named init, so to make the names unique, an external name is assigned to the parameters—fromFahrenheit and fromCelsius. This makes the full method names init(fromFahrenheit:) and init(fromCelsius:) respectively. It’s worth noting that in Swift, init methods are not inherited.

Creating an Instance of a Class


Brian Moriguchi

YouTuber I Am Dev’s Learn Swift 3 – Classes and Objects

I Am Dev’s Learn Swift 3 – Classes and Objects

YouTuber “I Am Dev” ‘s Learn Swift 3 videos explains Swift coding in very neat manner and at slow enough pace for a beginner. I wish there was IAmDev’s presentation version of Ali Fadhat’s contents, which would be perfect to me.

Brian Moriguchi

YouTuber Ali Farhat’s Swift Basic , Objects and Classes

YouTuber Ali Farhat’s Swift Basic , Objects and Classes

This YouTuber’s tutorial video explains line by line of  simple Swift code in plain English and concise simple manner and very useful for a beginner. I wish I could’ve found this video  few months ago, or has my understanding level finally reached to intermediate??? It sounds so easy and clear to me now 😉

Brian Moriguchi