Playground in Xcode 8

During session 213 of WWDC 2016, some changes to Playground in Xcode 8 were mentioned. The talk shows more tips and tricks to make use of the powerful Xcode features such as Assets Catalogs to avoid writing more code than what is necessary. I highly reccomend you to watch it!

To manage the execution of a Playground, the PlaygroundSupport framework can now be used. By ⌘ + clicking the framework name, this is what you can find:

  • A UIViewController and UIView extension that implement the PlaygroundLiveViewable protocol.
  • The PlaygroundLiveViewRepresentation enum which describes if the current live view shows a UIView or a UIViewController.
  • The PlaygroundLiveViewable protocol itself that has a variable to hold the current live view representation.
  • The PlaygroundPage class that allows you to modify the playground execution.

A Playground is compiled like a script, line after line. This is great until you want to test a network request that is performed asynchronously. You will never see the callback result because the Playground is simply stopped before the response can arrive. To fix this problem you have to tell Xcode that your page needsIndefiniteExecution. Let’s take a look at a common URLSession usage.

More …

Implement a UITableView in RxSwift

RxSwift is a reactive programming framework which enables easy composition of asynchronous operations and event/data streams. I’m currently building a Twitter timeline analyzer iOS app called Tweetometer to learn RxSwift. You can check out the code in the repository on Github. In this post I’d like to show how to build a simple UITableView with RxSwift.

Start by creating a new iOS project and set the language to Swift. You now have to install the RxSwift framework. Follow the instructions in the official repository to install it with CocoaPods or Carthage. If you choose CocoaPods, this is what your Podfile should look like.




          More …

My First Month in University


I started university a little more than a month ago and I thought it would be nice to share my experience. I had many discussions with other student developers about the pros and cons of studying computer science. I won’t go into the details if you should or should not go to university (or college or whatever you prefer). The goal of this post is to share my experience at USI (Università della Svizzera italiana) which is located in Lugano. My experience could highly differ from any other university which is nice if you want to compare it to your own experience.

I will try to focus a little more on my university program and not on the general case because each university has a different method of teaching and different programs. USI is a small university compared to basically every other school and the number of bachelor students in Informatics is 52. I really like the small number of students because a special connection with professors and teaching assistants is made.

All the classes are thaught in english (not a really common thing in non-english countries during bachelor) and so the english level is improved by just following a lecture. Many students obviously speak italian and during group projects we often end up speaking italian for simplicity and speed of communication.

Unlike other computer science programs, math is just a small part of the curriculum. One of the reasons why I chose this university over bigger and more popular universities was the focus on the practical skills.
One of the courses during the first semester is called Programming Fundamentals and is teaching Racket, a functional programming language. It is really interesting to get to know the basics of logics while having fun.
Another course is called Computer Architecture in which we learn the basics at a hardware level.
Maybe the most interesting course is Software Tools Atelier which is teaching the basic of Informatics in many different areas. In the first month an introduction was given about the Shell, LaTex, HTML and CSS.

There are many group projects which already started the first week. The goal is to teach team work which obviously is a very important thing in the industry. Homeworks are usually to be handed in in pairs so that’s a nice way to share opinions and skills.

There is a special course called Privatissimum which takes just one hour every week. All the students were split into small groups of 5-6 people and assigned to a professor. Every week we get together to talk about university problems and tips and trick to improve our daily student life. This goes to show how much the school cares about us.

I’m really enjoying my time in university so far. I couldn’t hope for a better start.

My first midterm is scheduled for next week, wish me luck!