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.
    View debugging
  • Playground – run your code directly without the Simulator. It even can be used to inspect and visualize your code complexity. But seems to have a dangerous bug, when you run system commands. see here
  • see more: WWDC 2014 Session ‘What’s New in Xcode 6’
  • or run Swift in Terminal
    /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift

    Run Swift in Terminal

Leave a Reply

Your email address will not be published. Required fields are marked *