Xcode IDE - Swift code

Image of an example of Swift code

When I started using the Swift programming language, I was surprised how similar it was to the other C-Type languages like Java, C-sharp, and C/C++. Yet, Swift is also quiet different with respect to the similarities to Objective-C in that Swift uses the same programming patterns to incorporate the many frameworks used to develop an application. It goes without saying who is behind this new programming paradigm. Objective-C has always been a difficult language because it is not at all like I have ever seen before, so I have never used it. Swift on the other hand, was easy to use. I believe anyone knowing the C-Type languages, will pick it up as easily as well.

Below is a Main Template for those coming from a C-Type language.

Open File Image

Power of Two

Below are two similar programs in Swift using the same Main Template but each program is slightly different in their method of power of two. One uses a for-loop and the other uses a bitwise-shift. The power of two of an integer has the result of an exponent with number two as the base and an integer as the exponent.

Power of two: For-loop

Power of two: Bitwise-shift