KTUIKit

KTUIKit is a Cocoa framework project that is currently in development.

The goal of the project is to provide solutions to three important issues in any Mac UI project:

  • Layout
  • Styling
  • The MVC design pattern (specifically the V & C parts)
  • At the moment, there are two parts of the framework in place, at various stages of development (sorry, no documentation yet!):

    The Views

  • KTView, et al.
  • KTLayoutManager
  • KTStyleManager
  • The Controllers

  • XSWindowController
  • XSViewController
  • There is also an Interface Builder plugin that provides a GUI for configuring the view’s layouts and styles. The GUI itself still needs A LOT of work and I will be focusing on that for the next update - along with providing some real documentation.

    Getting KTUIKit

    You can check out KTUIKit Xcode project from its Google Code Repository

    # Non-members may check out a read-only working copy anonymously over HTTP.
    svn checkout http://ktuikit.googlecode.com/svn/trunk/ ktuikit-read-only
    

    Or download the current build and an example application:
    KTUIKit 0.9.0

    Disclaimer:
    The example project is a good place to see the current build of the framework in action. I don’t suggest trying to use KTUIKit in your own project until a 1.0 is released. If you are just curious and want to test it out, you can follow these steps to get it up and running in your own project -

    Steps to use KTUIKit in an Xcode project

    The framework is designed to be embedded in the applications that use it. The following instructions explain how to use an embeddable framework in an Xcode project.

    Before you get started, give the KTUIKit Xcode project a good home. I keep it in a directory that is above the directories of all of the projects I use it in. After you have a good spot for it, build it and then:

    1. Add KTUIKit Project as a dependency of the project

    AddProject.png
  • Drag KTUIKit project file into the Application project’s ‘Groups & Files’ list in Xcode.
  • 2. Add target dependencies

    TargetDependency.png
  • Open the “Targets” group in the “Groups and Files” list.
  • Select the application target and hit the “Info” button in the toolbar.
  • In the “General” tab of the target’s Info window, there is a list of “Direct Dependencies”. Hit the Add (+) button.
  • A sheet will come down where you can select both the framework and plug-in from the KTUIKit project.
  • Add both.
  • 3. Add KTUIKitFramework to the project

    AddFramework.png
  • Go to the “Action” menu in the toolbar and select “Add/Existing Frameworks…”
  • Add the KTUIKitFramework.framework, which is located in the KTUIK project’s build directory in the “Uninstalled Products” directory.
  • 4. Create a New ‘Copy Files’ build phase

    CopyFilesBuildPhase.png
  • Open the “Targets” group in the “Groups and Files” list.
  • Open the application target to reveal the build phases
  • Go to the “Action” menu in the toolbar and select “Add/New Build Phase/New Copy Files Build Phase”
  • The Info window for the build phase will pop up. Change the selection in the “Destination” pop-up menu to “Frameworks”
  • Drag KTUIKitFramework from the “Linked Frameworks” group into the new build phase
  • Steps to use KTUIKit in Interface Builder

    Interface Builder doesn’t play well with embeddable frameworks.

    When a framework is embeddable, it isn’t actually installed anywhere. Instead, the current build of the framework is simply placed in a directory called “Uninstalled Products” in its Xcode project’s build directory.

    Interface Builder wants the framework to be in your ~/Library/Frameworks directory.

    You can do two things:

  • Put a copy of the framework in ~/Library/Frameworks or
  • Create a symbolic link in ~/Library/Frameworks to the actual location of the framework
  • I prefer the symbolic link solution because I am assured that Interface Builder is always using the most up-to-date build of the framework. Once you have done either of these two things, it is very easy to add the plug-in to Interface Builder.

    1. Either copy the framework or create a symbolic link to KTUIKit in ~/Library/Frameworks

    To copy:

  • Just copy it into ~/Library/Frameworks
  • To create a symbolic link:

  • In the Terminal application, cd to ~/Library/Frameworks and type the following command:
    ln -s /Path/To/KTUIKit/build/UninstalledProducts/KTUIKitFramework.framework
  • 2. Add KTUIKit plug-in to Interface Builder

    AddToIB.png
  • Launch Interface Builder
  • Go to the Preferences window and select the “Plug-ins” tab
  • Hit the add (+) button and navigate IB to KTUIKitFramework.framework in ~/Library/Frameworks
  • The KATI plug-in should now show up in in your Library.
  • KATIIBLibrary.jpg