Handle your Dependencies

Handling dependencies is the most important job in an application that uses third party frameworks. Good handling improves the maintainability of the project while bad handling dramatically increases refactor time and makes a project so bind and dependent to a framework which makes it very difficult to remove, even after days of refactoring.

Imagine your application as the image above, blue humans are native code while the red one is an external framework. Its contained in a block of bricks and no-one is authorized to enter.

If you want to know why read all about it in my post on medium.

See you on the next one.

Good News 😀

In just one year working at Atcom I got my first promotion! From a member of the iOS developer team, I was offered the role of the Technical Leader.
I am very glad because all the hard work finally paid off, and it did in just one year.
I’m very proud that the company I work for trusted me with the responsibility to guide the iOS team.

Farewell “Marathon Hero”

Marathon Hero was my first iOS Application and the reason I am working as an iOS professional until today. I am very happy that my first application is so cool, having great graphics and using Apple’s SpriteKit library I was able to produce a mobile game in my early years of coding.

So today I decided to remove Marathon Hero from the App Store because I can’t update it. It is coded in swift 1 (2014) and I seriously cant migrate it to swift 4. The code is very messy and very old. I will try to make a new game having the same name and character in the future.

See you in Marathon Hero 2 😎

Removing Dependencies – ObjectMapper

Introduction


Hello developers, this blog post and the nexts to follow are blog posts series in order to help you unlock you code by removing all the dependencies created when you install a cocoapod. The solution is quite simple, remove the cocoapods and start writing your own code! Have a good look and thought about it,  it’s time to become an engineer!

Good Old Networking


NSURLConnection and NSJSONSerialization, seriously what else do you need ? I learned them and I made my own Networking Models which they work fantastic! I really prefer writing my own code and especially for the Networking Component, in contrast with the majority of the developers out there who use the well-known Cocoapods, Alamofire and ObjectMapper extensively. So this post will try to encourage the reader to start writing his own code and leave Cocoapods aside.

The Open-Source Community


I am in favour of the open-source Cocoapods community but why not write your own code, you are the developer after all. Isn’t it better not seeing a podfile, instead of seeing “Analysing 42 dependencies…” on which you don’t know on what your application is dependent on. When I started learning Swift I was lucky enough my friend Mike taught me the basics of Networking without the use of Cocoapods. Learning from the ground up helped me a lot to understand how the networking part works. But there are developers out there with a few years of iOS experience and they don’t know how to make a simple API request and map objects without the use of Cocoapods.

The Revenge of the Swift


This year is the time to create your own Networking Model and you will carry on working on it, it will be yours, it will freaking work until iOS 56 and you wont have to make pull requests in case you wish to add something new.

Swift 4 is willing to help you by introducing two new protocols, Decodable & Encodable so you don’t even have to use JSONSerialization, but with 1 line of code, maps your server data into your native object. Before saying “bye bye” to ObjectMapper, let’s remember how you can map JSON objects using ObjectMapper.

Model:

struct Temperature: Mappable {
    var celsius: Double?
    var fahrenheit: Double?

    init?(map: Map) {}

    mutating func mapping(map: Map) {
        celsius <- map["celsius"]
        fahrenheit <- map["fahrenheit"]
    }
}

Mapping:

let user = Mapper<User>().map(JSONString: JSONString)

Before saying something about this library I would like to see the Swift 4 way and lets sum them later on.

Model:

struct Temperature: Codable {
    var celsius: Double?
    var fahrenheit: Double?
}

Note that the variable name must be exactly as the Server Response name or you could use  a CodingKey to decode with your custom keys.

Mapping:

let decoder = JSONDecoder()
let object = try! decoder.decode(Book.self, from: response)

For sure the swift 4 way is much more simple and clean. Good job 👍🏽, now you are ready to cross out this ObjectMapper pod of your podfile.

In the next blog post I will make the same example this time with URLSession instead of using Alamofire.

 

Saboteur

The online blog/magazine Saboteur offered me to develop their application, simple user-interface, minimal design and great optimisation for mobile devices. The application I developed is a client application and I was responsible for both the client and server side design, development, and testing. You can download it here.

Saboteur’s pre-existing API was not implemented correctly (not mobile friendly) so I had to re-build it along with their database. I decided to spend some more time working on the api in order to make it “lighter” than before. I wanted the final application to send and receive the Network Requests extremely fast.

I started uploading every photo or media with the option “export for the web”. This option is a must-have in web design as all media have to be minimal in order to support mobile devices. After I cloned the rest of the pre-existing database and made all the end points. Finally the API is very “light” and the returning data are always small and can be downloaded very fast.

I developed this application using the native frameworks even for the network requests. The application starts with a main TableView and maps 5 recent posts. The user can scroll down and the application will ask for 5 more posts. A post TableViewCell has a background photo and a title. The user can touch each post and read its data and view the media natively in the next screen.

Color Sequence

Color Sequence is my third iOS game and it is already on the AppStore in just 1 month of developing. I really loved working on this app because I believe it has the prospects of becoming a really famous game. The point of this game is to improve your working memory by a quick and funny way. You can download and play here.

The game is simple, you have to tap all balls from the first you see until the last. Each time you win and a new ball will enter the game and you have start tapping all over from the first one. There are currently two game modes, Normal and Fast 10. Normal mode is just for scoring the highest score and fast 10 is the time you needed to score 10.

The app provides Game Center Leaderboards so you can challenge your friends and see who has the best working memory!

Capstone Project

This application is my capstone project for Information Technology – Digital Media Capstone course. The “Adventures of Samurai Kai” is a mobile game designed for iOS devices. I was responsible for the graphic design and developing of this application.

Game Information:

You control a character named “Kai” and you are a Samurai. You are trapped in a dark forest full of creatures and traps. Your mission is to travel to the other side of the forest, fast enough and collect all necessary recourses without falling in the traps and letting the dark mysterious creatures destroy you.

Documentation:

Full App Documentation

Instructors feedback 

You have exhibited a high level of professionalism and passion that really helped ignite innovation and creativity.

— Zeppos Galanos

See you on the next one.

Marathon Hero

Marathon Hero is my first iOS game which I am very proud of. I have been working for 1 year and 3 months for both the design prototypes, app design and final development. I have used Apple’s SpriteKit framework and developed it with Swift programming language just when it was first released. For this project I have designed the game, developed the game for iOS, and developed a backend API to store the user’s high-scores.

Marathon Hero is a Free and Ad-free game available for iOS devices.

Marathon Hero on the AppStore

Marathon Hero API on GitHub

Marathon Hero website

Ratings 

Well done works flawless nice idea too

Perfect game lots of fun and very nice graphics!!

Source: iTunes Customer Reviews 2015