Archive for the 'Apple' Category

Subclassing in Interface Builder 3

Probably the most common question asked about IB 3 is: how do you subclass something? In IB 2, it was easy, right? You could just go to the class browser, find the class you wanted to subclass (typically NSObject), subclass it with a name, and then instantiate an instance of that subclass. But, what happened to the class browser in IB 3? Interface Builder 3 goes back to the idea of M-V-C: model, view, controller. For those of you familiar with this concept, you can ignore this next sentence: model is where you write code pertaining to data, view is where you write code or make graphics for what users see, and then finally, controller is where you write code relating to the response of user events. Thanks to Cocoa, the interface code is all written for us, and we can benefit from just dragging objects out of a library in IB. Our typical use to subclass an object in IB is to create a controller object or something similar that our interface talks to.

Note: Interface Builder is not the place to write code, that is the role of Xcode. IB has the ability to generate code, but more for a traditional sense. So the idea is to create a class in Xcode, and then bring the knowledge of that class into IB. Thanks to the smarts of IB, you don’t have to do any work for this, since IB is in constant communication with the pieces of your project. If you create a class, IB knows about it the next time you switch to IB from Xcode.OK, enough talk, how do I do this? Here is a step-by-step guide to subclassing something to use in IB (the example below is creating a subclass of NSObject called AppController)

  1. Create your class in Xcode
    In your Xcode project, add a new Objective-C class file by choosing New File… from the File menu. Name the file AppController.m.
  2. Instantiate your class in IB
    The instantiation process is two-fold. First, switch over to IB, and from the Library, drag an instance of NSObject (which you can find using the filter text-field) into your Document Window.
    Library

    And your Document Window should look something like this now:

    So now you have just instantiated NSObject, but what about your subclass? To make the instance you just created descend from your subclass, select in the Document Window, and then open the Identity Inspector (you can do this from the Tools menu, or if you have the inspector open, it is the sixth segment with the little “i”). Once the identity inspector is open, at the top of inspector, there is a slice called “Class Identity”, and under that is a text-field labeled “Class”. In that text-field, start typing the name of your subclass. As you are typing, by the time you get to “App”, it should have auto-completed the text-field with the name of your subclass. Again, please understand here, you no longer have to tell IB about classes in your project because IB has automatic integration with your project.

    Identity Inspector

    And your document window should now look something like this, with the “Object” replaced by “App Controller”.
    New Document Window

    At this point you are done, but if you would like to add connectivity to your class, proceed to step 3.

  3. Add actions and outlets
    Now that you have an instance of your subclass to work with in IB, you may very well want to add some connectivity between it and the interface. To do so, you can add outlets(IBOutlet) and actions (IBAction) to your class’s header file. To do so, go back to Xcode, and enter them where desired. If you need more help on this, please see the Cocoa tutorials on connections. Once you have created your outlets and actions in Xcode, switch back to IB, and by the time you do so, IB already has parsed your source code and found all of the outlets and actions, and they are now readily available for you to use.

So to quickly recap:

  1. Create your class in Xcode
  2. Switch to IB and add an instance of NSObject from the Library
  3. Change the instances class name to your subclass using the Identity Inspector
  4. Add actions and outlets
  5. Realize that subclassing in IB 3 is a lot easier than in IB 2

WWDC Keynote Review

On Monday morning, Steve Jobs gave his keynote at the World Wide Developer’s Conference, most commonly known as WWDC. There is a common saying, at Apple at least, where we call this keynote the Stevenote. There are a few reasons why this event has been tagged as such. First off, what is always included in the Stevenote is flashy stuff. The fluff of software is what Steve Jobs loves to show off. In the hallways of the Apple Campus, you hear engineers talk about how they spent one hour adding some flashy animation to an interface or changed the look of a button just so that Steve would like it, and want to show it at his keynote. The second characteristic of the Stevenote is that he always shows off something secret that no one else, except the engineers who worked on it, know about. And finally, the Stevenote is usually really good, and has you leaving the room excited and ready to go innovate.I regret to say that this year’s WWDC keynote may have hinted on the first two, but certainly fell short of the third one. The keynote was indeed flashy, as Steve demoed the latest features of the Mac OS called Leopard. The announcement of Safari on Windows was certainly surprising. But after the hour and half, I was bored, and ready for it to be done. Here are the things I liked and didn’t like about Steve Jobs keynote.

  • The new desktop?: One extremely misleading feature of Leopard is the “new” desktop. OK, maybe in terms of code a lot of new things are happening, but it was hardly worth the number one feature. There is a new silver dock, which I like, a deeper drop shadow on the active window, which I like, a unified UI, which I like, but the new menu bar? I loathe the new menu bar. It supposed to adapt to your background picture, but it ends up just totally being unreadable. In earlier versions of Leopard, they had a great menu bar, and two or three days we sent off Leopard to be duplicated for the developers, they changed it. And everyone hated it, and they ignored us. Now everyone at Apple and everyone at WWDC hates it.
  • Spaces: I actually love Spaces. There are a lot of people who don’t, but I do. It is an extremely useful way of getting rid of windows that you don’t want to see at the current time. It’s like having as many monitors as you want, only you don’t have to strain your neck to look at them. It’s just a keystroke, and your there. Great! There are currently two other ways to hide windows: minimize them or hide the entire application. Personally, I think minimizing windows is one of the dumbest ideas ever. Maybe that is one of the reasons why I hate Windows so much is because they hinge on that. I don’t want my window to go somewhere where I have to bring my mouse down and retrieve it. No. I want a keystroke to get it back. Hiding the entire application is a good start, because it can be done with a keystroke and retrieved with a keystroke, and it does not clutter up my Dock or anything. Of course, if I need these windows open so I can do a copy and then paste or drag and drop, the screen gets cluttered. Spaces opens up a lot of space, and its sweet.
  • CoverFlow in the Finder: I was watching the keynote in one of the employee rooms, and when Steve Jobs said that CoverFlow in the Finder was useful, our whole room burst in laughter. That’s because we had been trying to use it for the past month (for me) or months (for everyone else), and we could not find any use for it. Again, to be perfectly honest, I just don’t like the finder. I am perfectly content with cd, ls, cp, and mv.
  • Dashboard: When Steve Jobs needs five minutes to show off a movie widget, you know that he has absolutely nothing better to say. Dashboard is a memory sucking camel, and extremely over-hyped. Yeah, WebClip is cool. But I still do not think that he had to spend so much time on a Javascript widget that most developers could have written quite easily
  • Safari on Windows: This is a great strategy. Combined with the release of the iPhone, I think that lots of people, mainly iPhone developers, will use Safari in order to test their sites. I don’t mind Apple products on the Windows platform, especially when they run faster than their competitors.
  • A “sweet” way to make iPhone applications: Here at Apple, we have created a sweet way to create applications on the iPhone, they are called websites. Come on! Are we stupid? I do not think that dwelling on this sweet way of making applications was necessary or beneficial. I think anyone who has written a line of HTML would be offended by that. I know a lot of people who were.

So I have been pretty harsh on Apple, but I think we should. Apple is the leader of innovation, and they have extremely high standards around the globe. I think that the display that Steve Jobs put on was not on par with where it should be. I am looking forward to how Steve is going to dig himself out of this one.

Why is my blog so boring?

I think at this point a lot of people are probably wondering: “Why is Kevin’s blog so boring.” Well, I will give you an honest answer: my life outside of work is not too exciting. I would love to tell you about work, but then I would have to kill you. So, I will tell you what I can about my typical day.7:20: Good morningIt’s usually up pretty early, about 7:20, which means I don’t get out of bed until 7:30. Then I do the typical morning get ready deal to prepare myself for the day.7:40: DevosI can’t start my day without some time in the Word. Right now I am reading Jeremiah, after just completing a cover-to-cover reading of the entire Bible (which I would recommend to everyone, even if you don’t believe what it says). Devos also encompasses some time reading a devotional by Frederick Buechner called “Listening to Your Life.” I would say that it certainly has its gems.8:15: BreakfastBy now my roommates Dax Norman and Matt Pizzimenti are up, so we will eat breakfast together. I am a big fan of Fruit Loops cereal. Hey, it’s better than pop-tarts!8:30: Off to workI like getting out the door relatively early. The Apple Campus really doesn’t start until 11, so I have about 2 hours of solid quiet time to work on my projects. The walk to work only takes 5 minutes, but it is 5 minutes along a busy road and over a major highway, not the most serene walk. When I get to work, I usually will set up my workstation by wiring in my laptop to my iMac, read some emails, get some ice tea, and then get on with the work for the day.8:45 - 12:30: WorkAs with most people, I do work best in the morning. So I work hard until lunch. There’s not much else I can say here, except that I love what I do. For those of you who still don’t know exactly what I do, don’t fret, no one does. But I can tell you that I work on the Interface Builder Team for the Runtime Technologies Group, which is part of the Developer Technologies Department. I work with some great people, and the floor seems to glow with bright people.12:30 - 1:30: Lunch at Caffe MacsCaffe Macs is the place to go for lunch, and pretty much everyone ends up there between 11 and 2. They have quite the variety of food: a burrito bar, salad bar, sandwich bar, grill, Sushi bar, Asian salad bar, cooked pasta goods, pizza bar, gelato and dessert bar, and of course all of the other fruit and vegetable and bread tables. Great food, and very reasonably priced. Yeah so it’s not Google, but its still good food that I haven’t gotten sick of eating yet.1:30 - 6:00: Work time!As with the morning, this is just more work. By the now most of the office has woken up, so there is the steady hum of people milling about and asking question and running into bugs.6:00: Dinner or home, dependingBecause we are closing in on the conference (WWDC), there is a lot of work still to be done. So, a lot of people stay to do work all night. In fact, most engineers are on the noon to midnight work flow, or lunch to 3 in the morning work flow. So usually our whole department will go down to Caffe Macs where we get served dinner for free because we are working so hard for the conference.7:00 - 8:00: HomeI hardly ever stay past 7 or 8. I like to have a little time back at the apartment to read, relax, code, and organize photos. Other books I am reading right now are: Code Complete by Steve McConnell, and Mere Christianity by C.S. Lewis. I am still working hard on MacQuill, as I move closer to a beta release sometime soon.10:30: BedI don’t stay up late. By this time I am wiped, and I need to go to bed to get up and do it all over again in the morning.So is that still boring you?

WWDC Excitement

For those who don’t know what WWDC is, this post will not make any sense. So, I will explain it, and then give you a link to go to to additional information if it so pleases you.WWDC stands for “World Wide Developers Conference” as is Apple’s massive conference for their developers. Its a week in San Francisco filled with presentations on the latest technologies of Apple’s operating system Mac OS X, and allows people who write software for the Mac to come, listen, learn, explore, ask questions, talk to us engineers, and such.The nice part about the conference for Apple engineers is that we get to go the conference if we sign up to run lab sessions (times when developers can come and ask questions). So we get to go the conference for free. However, there are rules for us, and they are rather clear: the developers who pay their thousands to come to the conference as the kings and queens, and we are basically janitors. That means that we get last dibs on getting into presentations. So if I really wanted to go to a presentation on “Performance Tuning Applications in Leopard”, for example, and it was full, I wouldn’t be able to get in.Though obviously I get to go to the lab sessions I am running, or rather helping at. Those labs are:

  • General Developer Lab
  • Developer Tools Lab: Code-level assistance for Xcode, GCC, and Interface Builder.
  • Performance Tuning Lab: Code-level assistance for tuning performance of OS X applications with Xray, Shark, and D-Trace
  • Cocoa Bindings in Practice: Getting Started: Cocoa bindings is a collection of technologies that provide a means of keeping model and view values synchronized in your application. This encompasses how to create a more consistent user interface with less code, and how to refactor your code to leverage built-in classes.
  • Cocoa Bindings in Practice: Advanced: Receiving help on the most difficult Cocoa bindings problems.

But, most of the time, Apple employees get into sessions, and so there are a few sessions that I am really excited for. I am just going to paste the description from the WWDC website so you can get idea what these sessions are.

  • Building Animated Cocoa User Interfaces: Delight your users with dynamic, responsive user interfaces. In Leopard, standard AppKit NSViews can be rendered and animated using Core Animation. Learn how to combine familiar Cocoa controls, views, and event handling with the power of Core Animation layers to create stunning user interfaces.
  • Cocoa Drawing Techniques: The options available to the artistically-minded Cocoa developer have multiplied over the past few years. Learn about the appropriate use of NSImage, CGImage, CIImage, CGLayerRef, CG transparency layers, CoreAnimation, NSImageRep, NSCustomImageRep and more. We will also discuss HiDPI drawing and Cocoa’s resolution-independent architecture.
  • Coding Smarter with Objective-C 2.0: Learn more about Objective-C 2.0 and how you can take advantage of it in your own applications. You’ll receive an introductory, hands-on primer to properties, fast enumeration, and common garbage collection design patterns. Gain a deep appreciation for how Objective-C 2.0 will help you write better, more maintainable, and more concise code
  • Creating Leading-edge 2D Graphics with Quartz: Quartz is the high-performance 2D graphics system at the heart of the Aqua user experience. See how to directly access the Quartz 2D APIs to handle even the most advanced vector or bitmap drawing needs. Learn the fundamentals of the drawing model and how to use advanced rendering features to create high-quality 2D graphics. A key session for all application developers interested in creating more compelling 2D graphics in their application.
  • Getting Started Performance Tuning with Shark: Shark is very powerful, yet easy-to-use tool for discovering where your application is spending its time. Learn practical ways to find performance bottlenecks, obtain tips on optimization, and understand how your software interacts with the system. Gain an understanding of how Shark can help your application perform at its best in today’s multi-core, 64-bit world.
  • Getting Started with Mac OS X Kernel Programming: If you are new to Mac OS X kernel programming, attend this session to learn about the basics of the kernel architecture, building kernel extensions, and use of the kernel programming interfaces (KPIs) for maintaining release-to-release binary compatibility.
  • Making Your Custom Controls, Icons, and Artwork Resolution Independent: If your application uses custom controls or artwork, make this session a top priority. Modern displays vary in size and pixels per inch. Find out how to design a rich, scalable user interface for your application. The session will discuss guidelines for revising icons and artwork, new functions to adopt, testing strategies, performance concerns, as well as common problems and solutions.
  • Getting Started with Core Data: Core Data provides an infrastructure that manages model object graphs and object persistence. Learn how to use Core Data to define your application’s data model, access it from your code, and handle undo, redo, and data persistence. Find out how you can use Core Data to create high-performance, feature-rich applications.
  • Optimizing Your Core Data Application: Learn how to make your Core Data application perform as well as it can. Discover how you can use new APIs in Leopard to create your own store type, and how you can fetch managed objects more efficiently, or avoid fetching them entirely. Find out how you can optimize the managed object model itself for a particular problem domain, and use multi-threading to maximize the responsiveness of application.
  • Partitioning Your Cocoa Application: Multithreading and multiprocessing are powerful techniques you can use to improve your Cocoa application. Find out why and how to separate an application into independent pieces, and ensure those pieces interact smoothly. This is a good opportunity to build on your knowledge of multithreading and interprocess communication.
  • Tracing Software Behavior with DTrace: Get an introduction to DTrace, the popular open source project that Apple has optimized for and integrated into Mac OS X. DTrace is embedded in the core of Leopard, underpinning many analysis instruments in the new Xray application. Learn how to directly interact with DTrace from the command line to observe the runtime behavior of an application, the kernel, or the entire system to gain valuable insight.
  • Using Advanced Objective-C 2.0 Features: Gain advanced insight into using properties in threaded applications, implementing fast enumeration in your own classes, and designing rock-solid applications with garbage collection. This session builds on the concepts introduced in Coding Smarter with Objective-C 2.0.

So obviously I probably can’t go to all of these, but I will try to get to as many I can. It will be a busy week, with lots to learn. I’m pumped!

First week at Apple

I have completed my first week here in Cupertino, can you believe it has been that short amount of time? One week ago, my dad and I flew into San Jose, and a week later, I have been introduced to the culture of Apple and of its surrounding California sprawl.Has it been a good week? Of course. It has been an incredible week. I have had the chance to meet, to talk to, and to begin to develop friendships with the inventors of software that I use everyday. They have begun to teach me, to share what they know. It’s incredible. This summer is all about learning. Its all about knowing the fact that the person in the office next to me is the creator of Xcode, and the guy down the hall, he wrote Objective-C, and two floors directly above me sits the CEO of a company that has changed many of our lives. In this week, I have begun that learning experience. I actually am writing it all down, however I cannot publish it till Leopard gets released at WWDC in June because of the “confidential information” my blog page will contain.Thanks again for all those who are praying for me and supporting me. Your prayers are felt.One week down, hopefully many more to go.

First day at Apple

I apologize for not posting yesterday, we did not have internet temporarily.Today was the first day working at Apple. It was a day mostly filled with orientations and introductions (both with man and machine). In the morning was the four hour orientation, including mostly paperwork and them telling us that if we told anything to anyone about what we are doing, then they would kill us. So… I probably will never be able to tell you about what happens in my day, except big things like, “I went to work.” Sorry.After orientation, we met our manager and our team for lunch. They are really cool, and there is only a few of them (I am the sixth person on the team). The cafeteria is really good, a certain break from dorm food. After lunch I got a tour of my department (the Developer Technologies division), and met lots of people. Then my manager and I took a walk about the campus and talked shop before he showed me my cube. OK, it’s a cube, yes, but it has a huge window, and it is really open. The walls are only like 3 feet high, and it is really not bad at all. I actually think it is better than most of the offices (most people have offices, I saw like maybe three other cubes). Then I got to configure my workstation, and get all setup with accounts and such. I then spent the next two hours learning about my team, and the way IB (Interface Builder) does stuff. And we ended the day with the 4 o’clock coffee run.It was a good day, and Apple is a great company. It really is a good company. I don’t think it is just my love for Apple here, but just knowing more about the company. Apple rocks, and I am excited to be a part of it this summer.See my workspace here.

The first full day

Today was the first full day in California. We spent the morning at church: Menlo Park Presbyterian Church. It is really a cool church. The people are extremely nice, and John Ortberg (the pastor), is phenomenal. He is engaging, friendly, funny, but most importantly, he has content, and he uses the Bible! That, unfortunately, seems to be something a lot of pastors do not do these days. But the church cares about following the will of the Lord, and making an impact in the Bay Area.The rest of the day was spent with our friends the Docters, who live in Piedmont (just to the east of San Francisco). We drove up there, and spent a couple hours hanging at their house. They have decorated it so cool, and made their backyard a Jungle Cruise thing like in Disneyland, planting banana trees and bamboo. It is so cool. Then we headed into the city for dinner at a Vietnamese place. It was really good! But the Docters are great people, and fun to be with.A good first day in California.This post has an accompanying photo album

“I left my heart in Cupertino” (well, not really)

So, in case you have not already heard, which most people really have, this summer I will be interning at Apple Computer in Cupertino CA, about 45 minutes south of San Fransisco in the heart of Silicon Valley. Probably a question that you are more prone to ask is, what will you be doing? Well, I do not exactly know yet. I do know, however, that I will be working on the Interface Builder team. Interface Builder is an application that helps Macintosh developers make user interfaces. You can read more about Interface Builder by clicking on the link below.And by the way, I didn’t really leave my heart there. I actually am leaving my heart in Wheaton.Read more about Apple.Read more about Interface Builder.(I'm sorry if this image looks fuzzy in Windows)I’m sorry if this image looks fuzzy in Windows