Xcode 6 – View Debugging

Xcode 6 has a really cool feature: View debugging – which means that you can visualize your app’s view hierarchy

  1. Print the whole view hierarchy in a list
  2. See the view stack in 3D
  3. Retrieve super detailed information and properties about your view
  4. ….But…you can’t modify the view’s properties like with Reveal. I assume that Apple will add this feature in the Golden Master of Xcode 6

Continue reading

Xcode 6 and Interface Builder – Cool Stuff

Now I see a lot of benefits in working with IB instead of custom UIView classes. (This should be the end of the good old debate IB vs Code.

  • @IBInspectable which gives you access to your custom class properties & @IBDesignable which updates your interface in IB in realtime without compiling the app and launching simulator. There is an tutorial here which goes into more detail. Add the @IBInspectable in front of your properties and change the value via the didSet observer.
    @IBInspectable var borderWidth:CGFloat = 0.0 {
        didSet {
            layer.borderWidth = borderWidth
        }
        } 

    Interface Builder properties
    from now on you can change the custom property in the Interface Builder.

    Add @IBDesignable in front of the class

    @IBDesignable class YourCustomCell : UITableViewCell {
    ..
    

    See your custom UI in real time without running the app. Note: You need to put the class with @IBDesignable in a framework.

  • iOS Frameworks – Now we don’t need to stick with static libs. Using capsulated frameworks including assets is a big win in iOS 8. It looks like that Apple is encouraging the developers to use frameworks as often as possible (also for UIView components)
  • View debugging:  Reveal like feature to display the view hierarchy  – Now in Xcode you can snapshot the current view hierarchy and inspect the stack in 3D like in Reveal. Continue reading

Swift: Identity Operators

Comparing a pointer / instance in Objective C is easy:

object == anotherObject

But the == comparison in Swift checks the value and not the pointer, because there is no isEqual in Swift.
But how can we compare an instance in Swift when we don’t have the pointer?
Swift provides us identity operators to compare instances:
=== Identical to
!== Not Identiacal to

if tenEighty === alsoTenEighty {
    println("tenEighty and alsoTenEighty refer to the same Resolution instance.")
}

Excerpt From: Apple Inc. “The Swift Programming Language.” iBooks. https://itun.es/de/jEUH0.l

You can also use the Identity Operator to check if two arrays contain the same elements.

What’s cool in Swift

Swift Intro I’ve been programming Objective C since 2008 at tapwork. I always thought I need to blog about Objective C, iOS and Mac. But time is an issue. My public results were some code and little projects I share on GitHub like the super old non-ARC PunchScrollView. Now with Swift things changed a lot. It’s time to start something new and fresh. From now on I’ll try blogging continuously. The programming language will be mainly Swift. But sometimes it’s good to jump back to Objective C to compare things. I know there are already good intros to Swift here, hereFAQ & Apple itself … Check out these resources! Today I start with things in Swift I personally find really important and worth to understand what is going on.

  1. Type inference & safety
  2. Optionals
  3. generics 
  4. structs 
  5. Overriding functions
  6. Downcast / type check
  7. A lot more ….

Continue reading

App Usability: How-To incapacitate users

App Anleitungen
Imagine: In front of every stair case has an how-to: “Raise your legs, in order to go upwards”. This is what app developers / designers do with theirs users: How-Tos after launching the app. Actually the iPhone and all apps are famous for the good UX from the first day in 2007. There is no instruction guide packaged with your iPhone, because it is so easy.