I attended UIKonf (iOS developer conference in Berlin) this week. Great conference. I have been at UIKonf in 2014 but this time it was so much better for me because I talked to so many people. It’s not that the people have been more open this time.
It’s more like this time I met many people I knew from Twitter and Slack channels. In addition I have been grown more into the community since 2014.
Something else was different this time. For the first time I started to do sketch notes during the talks. I’m not good with sketch notes yet meaning that I cannot draw. As a result often I had to write words instead of drawing images. Nevertheless doing sketch notes helped me to stay focused and concentrated. And I still remember what was presented in most of the talks.
After each talk I published the sketch note to twitter and shared it with the speaker(s). This way the speaker got feedback about what key points I digested.
Sometimes you may wish you could tweak some values of your app (colors, font sizes, text) while you test it in the field. Or you would like to enable a feature to test it but don’t like to show that feature to your beta testers yet.
With my framework DDHTweaks you can do exactly this. You just need to add a bit of code to be able to change some values while the app runs.
Sometimes you need to add automatic tests for the UI of your app. There are several different approaches to achieve this.
In the test you could get the elements of the screen and assert if all the frames are as you expect. Depending on the UI you want to test, this can be a lot of work.
Or you could use UI tests provided by Xcode. But those are extremely slow and in my experience sometimes they just stop working.
There is a better alternative. Facebook has an open source component called FBSnapshotTestCase. This class allows you create snapshot tests. A snapshot test compares the UI of a view with a snapshot of how the view should look like. Let’s see how this works.
Did you know that you can create your own file templates for Xcode? Sure you did. But did you also know that you can create a template that takes a string and puts it into a field you define?
Let’s build a file template for a Swift protocol and a protocol extension.
Create a file template
First things first.
Xcode looks for your custom templates at the location ~/Library/Developer/Xcode/Templates/. We will start by copying a template that comes with Xcode to that location.
Yesterday I read this post by
Joseph Jude. He experienced that Swift is
way slower in solving the 4th problem from Project Euler when compared
to Python and Typescript.
In my opinion you should first learn Swift. This is the basis of
everything. If you don’t understand what functions can do in Swift, you
won’t understand the concepts of functional programming in Swift. In
addition, Swift is still mainly used to write apps for iOS and OS X.
This means, most of the time you need to interact with object oriented
APIs (at least at the time of writing ;)). So you also need to
understand object oriented Swift to leverage the potential of Swift when
writing Swift.
And even if you don’t believe me, this is what Chris Eidhof, Florian
Kugler, and Wouter Swierstra write in Functional
Swift:
„You should be comfortable reading Swift programs and familiar with
common programming concepts, such as classes, methods, and variables.
If you’ve only just started to learn to program, this may not be the
right book for you.“
I got some feedback to my last blog post about The best table view
controller.
In this post I want to comment on the feedback because the comment
sections is not really good for detailed discussion.
Storyboards
I couldn’t get Interface Builder in Xcode 7.3 to support typed view
controllers. While you can type in the associated class, the field
becomes blank when the storyboard is saved.
Interesting. I wasn’t aware of this. But this again tells me, that
storyboards (and the Interface Builder in general) are not suited for my
style of iOS development. As you may know, I don’t like the Interface
Builder.
If you depend on storyboards for your User Interface, than this kind of
table view controller isn’t for you (yet).
Since I read the objc.io post about light view
controller,
every few month I come back to the same problem: find the best way to
write a table view controller. I have tried several different approaches
like putting the data source and delegate in a separate class or using
MVVM to populate the cell.
This post is the March 2016 solution to this problem. And as most of the
times, I’m quite happy with the current solution. It uses generics,
protocols and value types.
The main part is the base table view controller. It holds the array to
store the model data, is responsible for registering the cell class and
it implements the needed table view data source methods.