• Sketch Notes At UIKonf 2017

    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.

    Read more...

  • Using DDHTweaks To Find Perfect Values

    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.

    Read more...

  • Testing the User Interface with FBSnapshotTestCase

    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.

    Read more...

  • Creating a "smart" Xcode file template

    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.

    Read more...

  • 4th Problem from Project Euler in Swift

    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.

    The 4th problem in Project Euler is this:

    A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.

    Read more...

  • Using a Playground instead of Keynote

    Yesterday I gave a talk at the Cologne Swift meetup and I tried something new. I used a Swift Playground for the “Slides”.

    Functions - Basics I.xcplaygroundpage 2016-04-22
09-22-36

    Read more...

  • What to learn first

    Yesterday I got asked, what a Swift beginner should learn first. Here is the question:

    I did want to ask you something, is it worth a while to learn TDD, or spend that time learning Swift, and functional programming?

    Of course, my opinion is a bit biased as I wrote a book about TDD with Swift. So, keep that in mind when you read my answer.

    Advice #1: Read the Swift Book provided by Apple.

    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.“

    Read more...

  • #selector() and the responder chain

    With the new syntax for selectors in Swift 2.2 the approach I used in “Utilize the responder chain for target action” produces a warning. Let’s fix that.

    Protocols for president

    First we add a protocol:

    @objc protocol DetailShowable {
      @objc func showDetail()
    }

    Then we can add an extension to Selector as described in this awesome post by Andyy Hope that looks like this:

    private extension Selector {
      static let showDetail = #selector(DetailShowable.showDetail)
    }
    Read more...

  • Feedback to "The best table view controller"

    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).

    Read more...

  • The best table view controller (Mar 2016 edition)

    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.

    Let’s start with the class declaration:

    import UIKit
    
    class TableViewController<T, Cell: UITableViewCell where Cell: Configurable>: UITableViewController {
    
    }
    Read more...



subscribe via RSS