brandontreb.com Tips And Resources For Software Consultants

Becoming A Software Consultant: My Backstory

I recently published a post about my first year of being an independent iPhone development consultant.  The feedback from my readers was incredible, however there was one important thread on Hacker News that I wanted to address.  The issues were:

One of my common hangups with these kind of posts is the lack of history as to what lead people to these consulting gigs. Where were you before, and how long were you there?

I found this to be a very valid point.  Far too often you see guys posting their end of the year profits from their consulting gigs and they make it sound extremely easy.  This can be dangerous as joe n00b might be so inspired that he quits his job and jumps right into the deep end without first preparing himself and assessing the risks involved.

That being said, I wanted to write a bit about my backstory and how it ultimately lead to my ability to strike it out on my own as a consultant.  I have read stories similar to mine and there are a few key points that seem to be common, which I will highlight as I go.

Circa Summer 2008 – Just Before Apple Releases The iPhone (not iOS) SDK 

In the summer of 2008, I was preparing to enter my senior year of college for Computer Science at UNM.  A quick note about CS in New Mexico.  There are TONS of government contractors (Sandia, Ultramain, Honeywell, Lockheed, etc.) in NM and college CS courses seem very much tailored to preparing students to head down this road towards one of these contractors.  This is where most of my buddies from college ultimately ended up.

So, like any good UNM CS student, I got a job at Intel hacking C# tools for their engineers to use during testing.  It was fine, but I knew I could not work in a cube forever.

Around that time, one of my buddies had the original iPhone and I was crazy jealous.  I think I had some silly Windows CE brick or a Palm Treo or something.  It was obvious that the iPhone was the “next big thing” and I took notice.  So I started developing web apps for the iPhone, as that was the primary way to get custom apps for the devices.  Apple even had a terrible (non mobile formatted) interface for exploring such web apps.

I built cool things like a Weight Watchers Point Calculator (my wife’s idea) and Minesweeper and to my surprise made a couple bucks a day on ads.  This really fueled my excitement.  Then, Apple announced the official SDK.

An Aventure In iCodeBlog And Other NDA Violations 

When Apple first released the SDK, the App Store didn’t exist yet.  All developers were forced under Apple’s NDA, stating that we weren’t able to discuss any aspect of the SDK on the web.  As you can imagine, this left very little resources available for learning how to actually do development.  There were no blogs, no books, and the only source of information was Apple’s documentation.  I saw this as a HUGE opportunity.

I very quickly registered the domain icodeblog.com and setup WordPress.  This led to my very first post in July of 2008. I had no idea what I was doing; it was my first blog ever, but I knew I would be able to learn more effectively if I was teaching others as I went along.

Being a Java developer, I was comfortable reading documentation so I dug right in to the iOS docs.  I spent all of my free time (the time that wasn’t spent with my wife) learning and blogging.  I was violating the NDA by discussing it on the web, but my page views were growing every day.  Other blogs started to sprout up but I soon had the most popular iOS development blog on the web.  I had over 10K RSS subscribers one month after my blog launch.

Things were really exciting, however, I had to start thinking about my future and how I was going to support my family.  Still being a bit narrow-minded with my career choices, I applied for a job at Lockheed Martin and got a position.  It was all set; I would graduate college in the spring and head to the “cube farm”.  Destined for a life of “here’s your input, give me this output”, TPS Reports, and other corporate stereotype jokes…

That’s when I got my first iOS programming job offer…

Enter RightSprite

As you can imagine, the popularity of iCodeBlog did not go unnoticed.  I received job inquiries quite often and one them happened to be from a guy who lived in Ireland named Jonathan.  He was a wealthy American entrepreneur who had added a mobile offering to his already successful rails consultancy called RightSprite.  However, he started his business by outsourcing to the Ukraine, which yielded fairly poor results.

So, in the winter of 2008 I received an email that they wanted to purchase iCodeBlog and give me a job replacing their outsourced team.  He also happened to have an employee in NM named Josh.  Josh and I met at a “hip” food place that I had never heard of and I was blown away that this was considered “business”.  Needless to say, I was excited.

So here I am, about to graduate with a perfect job lined up, and I get an offer like this.  I had no idea what to do.  The idea of working remote was foreign to me and had never even crossed my mind.  People can actually do that?  I can work in my pajamas??

So I decided to take a risk, sell him my blog, and accept the job offer.  I was terrified-especially when he told me that my first check was coming out of his personal bank account and that was why it was late.  Little did I know, this would be one of the best career decisions I could ever make…

Build, Hire, Repeat

I graduated from college and my career was in full swing.  I was the sole developer at a consultancy that had more mobile work than it knew what to do with.  My family had no idea what I did.  They though I was a drug dealer or something just as lucrative.  At one point, my grandma asked me, “When are you going to get a real job like your cousin Michael (he works for the city)”.  I could’t quite believe this was a legitimate job myself.

Things started to get very exciting.  Jonathan asked me to help hire our next employee.  Luckily, a guy by the name of Collin reached out to me and asked if he could guest blog on iCodeBlog.  A few tutorials later and we offered him a job.

RightsSprite continued to scale up and I helped hire quite a few new developers.  They eventually moved to a physical building in Portland, Oregon while I still worked remotely from NM.  The team continued to grow.

A Book Deal

Even though I didn’t own iCodeBlog anymore, I still contributed to it from time to time.  This lead to me being contacted by a few publishing companies with book offers.  A book offer?  It doesn’t sound that cool now, but in 2009, when there weren’t many iOS development books, it sounded incredible.

I decided to go with Manning Publishing and I updated their iPhone development book from web app-centric to SDK-centric.  It amazed me that I struggled to write four paragraph essays in high school but I was now writing a four hundred page book with ease.

The book did fairly well and sold around 10,000 copies.  Unfortunately, when you are an author of a tech book, that amounts to just about nothing in profit.  As you can imagine, I had little motivation to do the update the next year when Apple updated the SDK.

A New Sheriff In Town

Shortly after moving the offices to Portland, the owner sold the company and we had a new president and CEO.  He ran things a bit differently but ultimately things were cruising forward.  Our team continued to expand and eventually I hired our first Android developers.

In December of 2011, I was promoted to the Director of Mobile Engineering.  It was a fancy title and I was entirely proud to hand out business cards with that printed on them.  I had helped build the team up to around sixteen mobile developers and it was now my job to manage them, as well as work closely with sales to land larger contracts.

2012 was a great year of working on cool projects including the Food Network and Google Fiber TV.  I got to attend WWDC and spend a few weeks on Google’s campuses.

Things Get Shaken Up

Little did I know, there was some unrest in the company with the higher-up managers.  One day, there was a company memo that the three people who were higher ranked than myself had all left.  There were rumors as to why they left, but no one really had the true story.  This caused a stir in the company and a few more developers began to follow suit.

This, of course, led to some company restructuring which put me right at the top with one other team member.  I was now one of the highest paid people in the company and solely in charge of the entire mobile team.

I thought everything was perfect until one day in December of 2012, I received the following message when I logged into Gmail:

Your account has been suspended, please contact the administrator.

This made me considerably suspicious.  I knew there was a lot of restructuring in the recent history and I immediately wondered if I was next on the chopping block.  I was logged into Linked In at the time and noticed the company owner was the last person to view my profile.  “He suspects me of looking for other jobs and is checking up on me”, I thought.

That’s when I received a message on Skype from him.  It said:

Brandon, do you have time to talk?

My heart jumped into my throat.  I knew what was coming next.  He was soon up on video chat and proceeded to tell me that the company was undergoing some restructuring and my position has been eliminated.  “Eliminated?” I thought.  And then I asked him what that meant for me.  He repeated the sentence again, said thanks, and hung up.  That was it; I no longer had a job.

My “secure” job that I had been working at for four years disappeared in a matter of seconds with very little “real” explanation.  I was speechless.

Taking The Plunge

After getting “let go”, I took the rest of the day off and went out with my family (wife and two kids).  We were shocked, but I knew what I had to do.  It was what I had been dreaming of doing for quite some time.

Armed with the knowledge of the entire software pipeline-from sales, to development, to maintenance-I hit the ground running the very next day in search of my first contract.

I wrote this blog post documenting that very first month.

 

Takeaway

It has been a little over a year since I’ve had a “secure” job.  I put that word in quotes because I now believe the only way to have a secure career is to make one for yourself.  You could be let go at any time, for any reason.

I was very fortunate to have a first job that allowed me to learn the needed skills to do what I’m passionate about; building consumer facing apps that get used by thousands of people.  If you want to do the same, I would encourage you to find a job that lets you explore all of the aspects of consulting to find out if it’s right for you.

Sometimes I wonder why everyone is not a consultant.  It feels so free to be able to hack outside on a nice day or go sailing with my buddies on a random Wednesday.  But that’s just one side of the coin.  Other days, I wonder why I am even doing it.  I often wish I had a simple job with a well-defined task where once I got “off work”, I could go home and not think about it again until the next day but I don’t have that luxury.  There are real risks and stresses involved with working for yourself so I urge you to weigh them out before taking the plunge.

I have received so many good questions through my last few posts about consulting.  They have inspired me and I intend on taking this year to diligently blog about topics such as finding clients, health insurance, contracts, etc.

So please share and subscribe; I hope to help you on your journey to becoming free of your corporate chains.

This post is part of a series about becoming and independent software consultant.  I am participating in this series with my good friend Josh. You can read his take on this post here.

What I Learned In My First Year Of iOS Consulting

Wow, I can’t believe it has already been a full year since I struck it out on my own.  Last year, I published a post after my first month on doing contract iOS development.  Needless to say, I have grown and learned quite a bit over the past year and I wanted to share some of those experiences.

Income

While I won’t share exact numbers, I left my 6 figure/year job to pursue the indie/consulting life.  During the course of the year, I was able to amass 40% more income in 2013 than I had at my previous position.

In addition to that, I had the time to launch a couple iOS applications and thus upping my Apple income by about 20% this year.

Network Network Network

I would say spending time networking and meeting people is just as important as being able to write code if you want to be successful on your own.  Through out the year, I dedicated at least five to ten hours a week just meeting with people, talking on the phone, and making new connections.

Often times, I would get contract opportunities that I knew for sure that I wasn’t going to take; either because I didn’t love the project, or (more often than not) because I didn’t have the bandwidth to take them on.  However, rather than just writing the client back “I don’t have time“, I would take the call (or meeting in town), make the connection, and even listen to details about the contract.

My wife would tell me to stop wasting my time and that those hours would be better spent on project work that actually made money.  However, these contacts are arguably more valuable than the hours “lost”.  In many situations, I have reached out to those potential clients weeks or months later once I hired a new developer and was then able signed a contract.  If I had declined the meeting to begin with, they probably wouldn’t have been as inclined to work with me so readily.

Subcontractors

Subcontracting has been a mixed bag for me.  It seems to be the only (safe-ish) way to expand your business as a consultant, other than hiring full time developers.  So, if you want to be able to work less yourself (which is almost never the case) or increase your companies revenue, you need to hire out.  

Once I found the right people, subcontracting was a dream.  I was able to reach more clients, still deliver the same value in the work, and achieve the client’s goals, all while expanding my business.

The main challenge I have had is deciding whether to hire subcontractors from here in the states or “offshore”.  They both have their benefits and complications. Here are some I have found:

Benefits of hiring in the states:

  • Communication – Most of the time their timezones are close enough that one of you is not inconvenienced to communicate in real time.
  • Trust From Clients – Some clients still have some issues with “offshore”, especially because many of them have tried their hand at the ODesk lottery and have lost.  So, saying you have US based team members sometimes makes them more comfortable. It’s unfortunate, but I have seen it to be true in some cases.
  • Colleagues – Often times you already know or have worked with these guys since starting with acquaintances/friends is a good place to look for developers.

Complications hiring in the states

  • Cost – US devs are expensive.  Most of the time they have full time jobs and want to do consulting on the side.  So it is important that they get paid more to do contract work than their day job pays.
  • Colleagues – This is on the negative list as well because hiring people you know can get weird if things go awry.

Benefit of Offshore developers 

  • Cost – I put this here, however that doesn’t mean I hire “cheap” developers.  Honestly, if you are not paying a contractor well, you are either under paying him and should give him a raise OR he shouldn’t be working for you as he’s probably too junior.
  • Perspective – I have some incredible developers in other countries that have taught me quite a bit whether it’s about development, process, culture, or even my own code.  It’s a great opportunity to learn.

Problems with Offshore developers 

  • Location – Timezone issues can be a problem if you let them.  For example, I have a developer who lives in a completely different timezone than my own.  However, he does a fantastic job of being available when he is needed.  I have had other instances where it was very challenging to reach my developer in an event where I needed information on short notice.
  • Vetting Process – Finding developers is a little more tricky.  With devs in the states, you can just head to a local meet up or conference, but finding GOOD “offshore” devs is a little trickier.  I have lucked out a few times, but for the most part it’s a bit more work.  I would suggest spending a little of your own money to adequately search and vet each candidate.
  • Language – While doing iOS development, you may need your client and your developer to communicate with one another.  That being said, it’s vital to find a developer who you can understand and who can understand you in order to make communication possible.

Hiring An Assistant

Taking a page from Tim Ferris’ 4 Hour Work Week, I decided to hire an assistant.  Ferris suggests “virtual”, however, I have hired one locally (she’ll be proofreading this post 😉 ).  I think it’s one of the best decisions I have made as a business owner.  Here is just a short list of things she handles for me:

  • Contracts
  • Invoicing
  • Payments of contractors
  • Research
  • Phone calls
  • Personal issues (like returns, purchasing equipment, etc.)

Even if she saves me two hours per week, she has paid for herself, and believe me, she saves me much more than that.

Never Decline A Contract

I mentioned this earlier in the post, but I want to reiterate it here.  I seldom tell clients “no” and I really feel that it has worked out to my benefit.  At the very least, I hear them out and add them as a contact to keep in mind for the future.

What I generally do when I can’t take on a client is I will give them an estimate of when myself or a member of my team will be available.  That way, if they are okay with the timeline, I can keep the pipeline open.  If not, there is no harm done.  Also, if I hire another developer before the time I said I was available, sometimes the client will still have the need and I am able to fill it.

If I absolutely don’t have time or don’t want a particular contract, I will refer the client out to other dev shops.  I don’t look at this as competition, but rather opportunity as I would hope they would do the same for me one day.  As an added bonus, some of them have a referral fee so you can at least profit from pairing the client up.

Taxes

I have found out that taxes are less fun when you are self-employed than when you are employed by a business.  Luckily my wife is MUCH better at money management than I am, so she set up a separate tax account where roughly 40% of our income would go.

One of the other good decisions I made besides hiring an assistant was hiring a CPA.  She has saved me countless hours and fees and is worth her weight in gold.

Hire a CPA from day one; you will never regret it.

Family

I know this is a “business” related post, but I have to mention this.  Having a wife and kids, I am very much a family man.  Working for myself has been such a blessing since I have been able to spend considerably more time with my family than when I was employed by someone else.

For example, if it’s a nice summer day and the family decides to head to the zoo, I can just go without asking a boss for time off or taking PTO.  I simply work in the evening or more hours the next day to recoup the time.  Personal time management is key to be able to have this kind of freedom.

Summary

Overall, 2013 was an incredible year.  While I did make mistakes (a ton), I gained so much knowledge and had a blast doing so.  Going solo isn’t for everyone (some days I wonder why everyone** isn’t** doing it, and others I wonder why I am), but it’s been one of the most exciting experiences of my life.

I look forward to what 2014 brings and seeing how I can continue to grow my consultancy.

Happy New Year and Happy Hacking!

The Top 5 Places To Find Good Software Developers/Contractors

One thing I am often asked is “Where can I find good developers/contractors/subcontractors?” While I have found talent many different ways, I wanted to share my top 5 with you.

This post should be useful to you if you have a project and are looking to find a developer OR are a developer looking to subcontract some of your work.  I am sharing these based solely on my experiences with them and hope you find value in this list.

1. Local Meetups

Local meet ups are the absolute best place in my opinion to find developers.  Almost every city in the nation has some sort of group meeting on a regular bases for a given focus of development.  You should have no problems finding a rails meetup group, iOS, Android, etc…

I would suggest finding out about such meetups in your area by Googling phrases such as “[your area] iOS meetup (sub iOS for rails, python, etc…).  I regularly attend a “Cocoa Heads” group full of incredibly smart and capable mobile developers all willing to work on projects.

These types of groups are always excited to have clients come in and pitch their ideas.  One piece of advice though, don’t go in to these groups and start with “I have a great idea and I will give you a percentage of the company in exchange for development”. They will stop listening immediately.

This one is going to require a bit of work and research on your part, but I will get you started.  Around the internet, there are a few of what I call “celebrity developers”.  These are generally guys who have made a name for themselves and who are established as experts in their space.

While many of them are not taking on contract work themselves, they may or may not have a mailing list of interested contractors.  One such person that does exactly this is Ray Wenderlich and I happen to receive emails on his contractor list.

Even if these developers don’t have lists, they generally have plenty of connections to point you in the right direction.  Like I said, this method isn’t easy, but it can definitely have one of the biggest payoffs in terms of quality developers.

3. Specialize Project Sites

As of late, quite a few interesting sites have been popping up that have solved a fundamental issue when it comes to pairing developers with projects. The problems are 1. it’s hard to find good developers and 2. it’s hard to find clients with realistic cost expectations. That’s why ODesk exists 😉

The first of these sites that I have found is OOOMF.  OOOMF is relatively new and you must be reviewed and accepted by their team in order to be a part of it.  It’s basically a private network for pairing developers with projects and it supports all different project types (mobile, web, design, etc…).

Project owners can put their project up with a relative budget and developers can “apply”.  The process then moves forward with communication between the client and the developers until a price and scope have been reached.

There is an additional overhead of 15% for using this service, but I think it’s well worth it.

Another one of these sites that is more mobile centric is http://apphappening.com.  This site is very new and I have only just begun to use it.  I should have a better review of them shortly.

4. Twitter and App.net

Twitter and app.net are definitely the preferred social network of serious developers.  I would steer clear of Facebook and Linked in as this is generally where the recruiters hang out. Your message will most likely get dismissed as spam.

I’d suggest searching Twitter/App.net for the keywords of your project (iOS developer, rails, etc…) and find the folks with a ton of follows and a very small following to follower ratio. You will know them right away.  Also, most of their blogs come up first in Google for many related keywords.

5. Developer Conferences

This one might cost you a bit of money, but is definitely well worth it.  There are conferences for every focus of software development and they occur all throughout the year.  These conferences generally have a HUGE percentage of professional developers who are just as eager to work on a project as you are to have them.

One of my favorite iOS conferences is 360iDev. It’s very indie-centric and offers an incredible community of iOS developers of all abilities.  If you are looking to get a mobile project done, I strongly urge you to attend.  While I can’t speak for conferences in other areas(web, etc..), I would really love some suggestions in the comments of this post if you are up for it!

6. Bonus – Right Here

Shameless plug time.  If you are looking for professional mobile app (iOS or Android), I have a team of developers and am always looking to work on new and exciting projects.  If you want to hear more about it head over to my Hire Us page or shoot me an email brandon @ pixegon [dot] com.

Conclusion

Whether you are a person/company looking to hire developers or a developer looking to hire contractors, I hope you have found this post useful.  Your feedback in the comments is greatly appreciated.  Best of luck with your search!

iPhone Programming Tutorial: Creating An Image Gallery Like Over – Part 2

Screen Shot 2013-08-09 at 8.36.42 PM

 

Welcome to the second part of my tutorial series “Creating An Image Gallery Like Over”.  In this part of the tutorial, you will learn how to actually display the photos in the UICollectionView as well as give the user the ability to take photos with their camera.

If you haven’t already done so, please go back and complete part 1.

1. Custom UICollectionViewCell

Start by creating a new subclass of UICollectionViewCell and naming it PhotoCell.  Now, open up PhotoCell.h and add the following code:

#import <AssetsLibrary/AssetsLibrary.h>
 
@interface PhotoCell : UICollectionViewCell
@property(nonatomic, strong) ALAsset *asset;
@end

Now, open PhotoCell.m and add the following code:

#import "PhotoCell.h"
 
@interface PhotoCell ()
// 1
@property(nonatomic, weak) IBOutlet UIImageView *photoImageView;
@end
 
@implementation PhotoCell
- (void) setAsset:(ALAsset *)asset
{
    // 2
    _asset = asset;
    self.photoImageView.image = [UIImage imageWithCGImage:[asset thumbnail]];
}
@end
  1. This is an IBOutlet to a UIImageView that we will create inside of the Storyboard
  2. We overwrite the setter method for the asset in order to convert the asset’s thumbnail into a UIImage and set it to the contents of the UIImageView

Now that we have the custom cell created, we need to hook it up and create the UIImageView inside of Storyboard.  Open MainStoryboard.storyboard and click on the default UICollectionViewCell inside of your UICollectionView.

It might be tricky to see the cell as it has a white background and blends in, but it’s there.

Screen Shot 2013-07-24 at 6.43.38 PM

Now, click on the Identity Inspector from the right side bar and change the class to PhotoCell.  This will inform interface builder that this object is of the type PhotoCell and let us hook up the photoImageView outlet.

Screen Shot 2013-07-24 at 6.46.35 PM

Next, open the size inspector, change the size to Custom, the width to 104 and the height to 104.  This will give us nice sized images, with a good amount of padding between them.

Screen Shot 2013-07-24 at 6.49.51 PM

The UICollectionView will overwrite these sizes, so we need to change it in one other location.  To ensure that the cells stay the correct size, click on the Collection View in left side bar and open it’s Size Inspector.  Then set the Cell Size width and height to 104.

Screen Shot 2013-07-24 at 7.07.14 PM

The final step here is to drag a UIImageView on to your cell (scaling it to fit the entire cell size), and hook up the IBOutlet to the photoImageView. Do this by control-click and dragging from Photo Cell to the ImageView and selecting photoImageView.

Screen Shot 2013-07-24 at 6.52.32 PM

If you build and run at this stage, nothing will be different.  That’s because we still need to tell the ViewController class about our new PhotoCell.  Open ViewController.m and import PhotoCell.h.

#import "PhotoCell.h"

Now, head down to the collectionView:cellForItemAtIndexPath method and replace the contents of it with the following code:

- (UICollectionViewCell *) collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    PhotoCell *cell = (PhotoCell *)[collectionView dequeueReusableCellWithReuseIdentifier:@"PhotoCell" forIndexPath:indexPath];
 
    ALAsset *asset = self.assets[indexPath.row];
    cell.asset = asset;
    cell.backgroundColor = [UIColor redColor];
 
    return cell;
}

What’s changed here is, we are now telling the UICollectionView that the cell it’s returning is of the type PhotoCell. Also, we are fetching the ALAsset out of our array at each index and sending it to the cell so that it can display it’s thumbnail.

Build And Run!

Screen Shot 2013-07-24 at 7.10.39 PM

WhoohooYou should now see your photos populating the **UICollectionView. Congratulations! </p>

</strong>While, this is definitely cool, you might now be wondering “how do I select a photo?”.  Great question, and here is the solution.

2. Selecting Photos

Now that you have all of the groundwork in place, selecting photos from the collection could not be easier.  Open up ViewController.m and replace the collectionView:didSelectItemAtIndexPath method with the following code:

- (void) collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
    ALAsset *asset = self.assets[indexPath.row];
    ALAssetRepresentation *defaultRep = [asset defaultRepresentation];
    UIImage *image = [UIImage imageWithCGImage:[defaultRep fullScreenImage] scale:[defaultRep scale] orientation:];
    // Do something with the image
}

This will get the selected asset and convert it to a UIImage. You are now free to use the UIImage how you want. Perhaps you create a protocol for this class and make a callback to a delegate OR maybe you add this to a UINavigationController stack and push a new view controller on to the stack containing this image. The sky is the limit!

If you look at the Over app and back to your image gallery that you just created, you will notice something is still missing.  What if the user wants to take a photo or access other albums?  This is where Over adds a bar across the top of the interface with 2 buttons that fall back to the “default” style of fetching images if the user wants to take a photo or access a different photo album.  Let’s build this out now.

3. Building The Interface To Take Photos And Access Albums

Start by setting up the IBActions for theses buttons.  Open ViewController.m and add the following empty methods:

#pragma mark - Actions
 
- (IBAction)takePhotoButtonTapped:(id)sender
{
 
}
 
- (IBAction)albumsButtonTapped:(id)sender
{
 
}

We don’t need to add the code yet since we still need to build the UI and hook up the IBOutlets. Now open MainStoryboard.storyboard and drag a UIView right on top of your UIView.

One issue you might run in to here is the view will want to become a subview of the collection view.  To combat this, drag the view outside of the collection view inside the left bar so the hierarchy will look like this:

Screen Shot 2013-07-25 at 12.35.06 PM

 

One other “gotcha” is, you must ensure that the view is positioned below the collection view in this list, otherwise it won’t show above it on screen.

Now, let’s manually size and position the view as Interface Building will make things hard on us if we want to position it over our collection view.

Select the view and open the Size Inspector. Set the values as follows:

Screen Shot 2013-07-25 at 12.44.23 PM

 

Again, remember this positioning is optimized for the iPhone 5. So make sure you are testing with that simulator or you won’t see this bar.

After this, the bar still won’t be visible inside of Interface Builder.  We need to set the background color to black with some transparency.  Open the Attributes Inspector and click on the background color.  Then set the color to black with 80% opacity:

Screen Shot 2013-07-25 at 12.40.13 PM

 

You should now see the bar positioned on the screen like this:

Screen Shot 2013-07-25 at 12.41.54 PM

 

Now drag a UIButton on to the view you just created. There are a few things that must be done to style the button:

  1. Position it at 0,0
  2. Set the width to 160px and the height to 70x
  3. Change the type to custom
  4. Change the text to “Take Photo”
  5. Change the font to “Helvetica Neue Condensed Black” size 20
  6. Set the text color to white

When you have completed these steps, the button should look like this:

Screen Shot 2013-07-25 at 12.47.26 PM

 

Now, hook up the IBAction by opening the Connections Inspector and dragging from Touch Up Inside to the View Controller object and selecting takePhotoButtonTapped:

Finally, duplicate this button (copy and paste), rename the title to “Albums”, move it next to the “Take Photo” button and hook its Touch Up Inside to albumsButtonTapped:

The final Interface should look like this:

Screen Shot 2013-07-25 at 12.51.25 PM

 

Go ahead and do a Build and Run and this stage and marvel at your interface development prowess!

4. Actually Taking Photos And Accessing Albums

The final step for this tutorial is to implement the code to bring up the camera as well as bring up the photo albums.  Let’s start with the camera.  Open ViewController.m and add the following code to the takePhotosButtonTapped: method:

- (IBAction)takePhotoButtonTapped:(id)sender
{
    if (([UIImagePickerController isSourceTypeAvailable:
          UIImagePickerControllerSourceTypeCamera] == NO))
        return; // 1
 
    // 2
    UIImagePickerController *mediaUI = [[UIImagePickerController alloc] init];
    mediaUI.sourceType = UIImagePickerControllerSourceTypeCamera;
    mediaUI.allowsEditing = NO;
    mediaUI.delegate = self;
    // 3
    [self presentViewController:mediaUI animated:YES completion:nil];
}
  1. Makes sure that the photo library is available.  If the user declines photo access, this will be the case.
  2. Create the UIImagePickerController and set its source type to UIImagePickerControllerSourceTypeCamera.  This lets the media picker know to use the camera and not the image library.
  3. Finally, present the view controller modally

The method to bring up the photo albums is almost identical to the method above.  Add the following code to the albumsButtonTapped: method.

- (IBAction)albumsButtonTapped:(id)sender
{
    if (([UIImagePickerController isSourceTypeAvailable:
          UIImagePickerControllerSourceTypePhotoLibrary] == NO))
        return;
 
    UIImagePickerController *mediaUI = [[UIImagePickerController alloc] init];
    mediaUI.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;    
    mediaUI.allowsEditing = NO;
    mediaUI.delegate = self;
    [self presentViewController:mediaUI animated:YES completion:nil];
}

As I said before, this method is almost identical with the only difference being, we are using UIImagePickerControllerSourceTypePhotoLibrary to open up the photo albums.

Build and Run and tap the “Take Photo” button. Make sure you are testing on the device at this stage or nothing will happen since the simulator doesn’t have a camera.  You can however test the “Albums” button assuming you have some photos in your photo library.

Now that you are able to pick a photo, you need to be able to access the photo that was selected or taken.  To do this implement the following delegate method for UIImagePickerController.

#pragma mark - image picker delegate
 
- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    UIImage *image = (UIImage *) [info objectForKey:
                                          UIImagePickerControllerOriginalImage];    
    [self dismissViewControllerAnimated:YES completion:^{
        // Do something with the image
    }];
}

This method fetches the selected (or taken) image and stores. It then dismisses the camera or photo albums allowing you to do whatever is needed with the image.

5. Next Steps

By now, you should have learned how to use the ALAssets library to interact with a user’s photos and use them to build a custom interface. You also learned how to use a UICollectionView to display a grid of photos.

With this knowledge in hand, you should now be able to make much more interesting photo selection interfaces than the default one Apple has to offer.  Other apps like Google+ and Instagram both have very slick photo pickers and I hope this tutorial has your gears going thinking about other interesting photo selection interfaces.

You can download the source from this tutorial on GitHub

Feel free to leave a comment if you have any questions. Happy Hacking!

 

iPhone Programming Tutorial: Creating An Image Gallery Like Over – Part 1

Screen Shot 2013-08-09 at 8.36.42 PM

 

Recently, I have had to build an app (download link) that required the user to choose a photo from their photo library.  Rather than just throwing up a UIImagePickerController like many apps, I decided to add a little bit of style.  Being inspired by Over’s ultra simplistic (and beautiful) photo selection interface, I decided to fancy things up a bit.

For this tutorial, I will start with a Fresh iOS6 View-Based application that uses Storyboards and ARC. Also note that I will be optimizing for the iPhone 5 resolution.  You are free to make the tweaks necessary to deploy on the iPhone 4 and 4S.

 

Here is a breakdown of what we will cover in this part:

  1. Creating a UICollectionView inside of Storyboard
  2. Using the ALAssetsLibrary to fetch photos from the user’s Camera Roll
  3. Displaying the ALAssets inside of the UICollectionView

1. Preparing The IBOutlets

Start by opening up ViewController.m **and replacing the **@interface declaration at the top with the following code:

@interface ViewController ()<UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout>
@property(nonatomic, weak) IBOutlet UICollectionView *collectionView;
@end

This will declare the IBOutlet needed to hook up the main UICollectionView that we will be using to display the user’s photos.  I have also set up our class to be a UICollectionViewDataSource, UICollectionViewDelegate, and UICollectionViewDelegateFlowLayout. This is necessary when interfacing with the UICollectionView.

2. Setting Up The UICollectionView In Storyboard

Open up MainStoryboard.storyboard and drag a UICollectionView on to your view ensuring that it stretches the entire screen.

Screen Shot 2013-07-21 at 8.44.02 PM

Then, Control-Click and drag from the UICollectionView to your ViewController Object and set it as the delegate and datasource.

Screen Shot 2013-07-21 at 8.41.29 PM

Finally, Control-Click and drag from View Controller to Collection View and selected collectionView to make the IBOutlet connection.

Screen Shot 2013-07-21 at 8.45.05 PM

Now, we need to give a Cell Identifier to the UICollectionViewCell so that we can reference it in code.  Click on the default cell inside of the UICollectionView and open the Attributes Inspector. For the Identifier type in PhotoCell. The cell might be a little tricky to see as its background color is clear, but it’s there. Simply click in the top left corner of the UICollectionView.

Screen Shot 2013-07-21 at 9.13.08 PM

Now that the UICollectionView has been set up, it’s time to fetch the photos from the user’s photo library.

If you are using the simulator, make sure to populate the Photo Gallery with images from the web. Simply open up a browser, do a Google Image Search, and click and hold on various images. You should have an option from the menu that pops up to save the images to your camera roll.

Finally, open up the Photos app on the simulator to initialize the Assets Library.

3. Fetching ALAssets (user photos) From The ALAssets Library

In order to interface with the user’s photo library, we must first import the AssetsLibrary.framework framework.  To do this, click on your project in the sidebar, select the Target, then click Build Phases, expand the Link Binary With Libraries section and click the button.  Do a search for Assset and then double click on AssetsLibrary.framework.

Screen Shot 2013-07-21 at 8.57.37 PM

It should now be added to your project and ready to use.  Now that it has been linked, we must import it into the ViewController.m file.  Open up ViewController.m and add the following import to the top of the file:

#import <AssetsLibrary/AssetsLibrary.h>

Before we can fetch the user’s photos, we need to set up an NSArray to put them in.  Add the following line within the @interface declaration at the top.

@property(nonatomic, strong) NSArray *assets;

Now, add the following method to your class:

+ (ALAssetsLibrary *)defaultAssetsLibrary
{
    static dispatch_once_t pred = ;
    static ALAssetsLibrary *library = nil;
    dispatch_once(&pred, ^{
        library = [[ALAssetsLibrary alloc] init];
    });
    return library;
}

This is a static method that creates a static instance to the ALAssetsLibrary.  The reason this is needed is, when we enumerate the ALAssets in the next method, it seems that the assets get released immediately and otherwise wouldn’t be able to be used in the rest of the application. I will explain this a little more in a moment.

Head over to viewDidLoad and add the following code:

- (void)viewDidLoad
{
    [super viewDidLoad];
 
    _assets = [@[] mutableCopy];
    __block NSMutableArray *tmpAssets = [@[] mutableCopy];
    // 1
    ALAssetsLibrary *assetsLibrary = [ViewController defaultAssetsLibrary];
    // 2
    [assetsLibrary enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
        [group enumerateAssetsUsingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) {
            if(result)
            {
                // 3
                [tmpAssets addObject:result];
            }
        }];
 
        // 4
        //NSSortDescriptor *sort = [NSSortDescriptor sortDescriptorWithKey:@"date" ascending:NO];
        //self.assets = [tmpAssets sortedArrayUsingDescriptors:@[sort]];
        self.assets = tmpAssets;
 
        // 5
        [self.collectionView reloadData];
    } failureBlock:^(NSError *error) {
        NSLog(@"Error loading images %@", error);
    }];
}
  1. Grab our static instance of the ALAssetsLibrary
  2. Enumerate through all of the ALAssets (photos) in the user’s Asset Groups (Folders)
  3. Enumerate each folder and add it’s ALAssets to the temporary array
  4. Sort the assets list by date (this won’t work yet, but I will show you how to fix later). For now this code is commented out and the Assets will be sorted however they come out.
  5. Reload the UICollectionView (this won’t work yet as we haven’t set up the delegate methods)

Now that we have an NSArray populated with ALAssets, let’s set up the delegate methods for the UICollectionView in order to populate it with data.

4. Populating the UICollectionView With Data

UICollectionView functions much like a UITableView having delegate and datasource methods.  Add the following methods to your ViewController class to populate the view.

#pragma mark - collection view data source
 
- (NSInteger) collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return self.assets.count;
}
 
- (UICollectionViewCell *) collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    UICollectionViewCell *cell = (UICollectionViewCell *)[collectionView dequeueReusableCellWithReuseIdentifier:@"PhotoCell" forIndexPath:indexPath];
 
    ALAsset *asset = self.assets[indexPath.row];
    //cell.asset = asset;
    cell.backgroundColor = [UIColor redColor];
 
    return cell;
}
 
- (CGFloat) collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section
{
    return 4;
}
 
- (CGFloat) collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section
{
    return 1;
}

This code should be fairly straight forward if you have ever worked with a UITableView.  The only lines to note are where ‘cell.asset = asset’ is commented out and we set the cell’s background color to red.  We will uncomment that line when we create a custom cell to display the image (for now it won’t).  I have also set the background color to red so that you can see that the number of cells is actually corresponding to the number of photos in the camera roll.

Build and Run!

Let’s take a break to do a build and run to see what happens.  If you have hooked everything up correctly, you should see a black screen with red squares on it with a count equalling the number of photos in the user’s library.

Screen Shot 2013-07-21 at 9.26.07 PM

Not too exciting, however it shows that we are displaying a number of cells corresponding to the number of photos in the user’s asset library.  At least it’s showing that you have done something.  The next step is to create a custom UICollectionViewCell that actually displays the photos, which we will do next time.

5. Next Time

That’s all for today.  In a ploy to get you to come back to my site (and subscribe to my RSS feed), I have chosen to break this post up into two parts.  

Luckily for you, I wrote the above message a while ago. Click the link below to go to part 2!

iPhone Programming Tutorial: Creating An Image Gallery Like Over – Part 2

Stay tuned!

Back To My Roots

I wrote my very first blog post back in July of 2008 when I start iCodeBlog.com.  I started the blog because I saw a huge need for iOS development tutorials on the web and really wanted to help others as I progressed in my development.

Well, quite a bit has changed since then.  I have written books, spoken at conferences, and built and shipped over 40 iOS applications.  Since selling iCodeblog in 2009, I have really let my passion for blogging fizzle.  For the first 2 years of the iCode sale, I wasn’t allowed to write tutorials on any other site.  This was very discouraging.

Over the years, I have guest blogged iOS tutorials on several sites including mobile.tutsplus.com and raywenderlich.com.  This has been pretty hit or miss for me.

As of recent, I have become an independent iOS developer and have been solving quite a few hard problems and coming up with some interesting solutions on projects that I have been a part of.  I now want to share some of those solutions with the iOS community in the form of tutorial blog posts.  These come in all shapes in sizes from cool UIKit hacks to building simple backend services.

So, when I say that I want to “get back to my roots”, I really want to start consistently blogging again and educating other developers using the knowledge I have gained over the years.  So stick around, subscribe, follow me, and please don’t hesitate to suggest tutorial ideas.

Happy hacking…

Tools of The Trade: What Tools I Use For iOS Consulting

Welcome Hacker News! There’s some discussion happening in the comments; but, as always, the better conversation is on the article page on Hacker News itself.

Since going Indie, I am constantly asked about what software tools I use to facilitate the process. People are always curious about invoicing, time tracking, ticket management, etc…

The purpose of this post is two fold. First, I want to educate others on some of the cool tools I have found that have helped me out tremndously. The other is, I would hope that veterans in the space could give their two cents as to some better tools (or better use of the current one’s). Either way, I’d love to hear from you.

1. Tools For Finding Contracts

This is perhaps the area where I am most asked about. Well, the secret is, looking for contracts isn’t that much different than looking for a job. You just need to know what to look for. Here are the few major sources where I have found sucess in finding good contracts.

  • Linked In Jobs I love Linked In. I have found it to be the most valuable tool for job searches and connecting to date. I love that it will suggest jobs/contracts to you based on your profile and experience. Another great thing about Linked In is contract search can become passive if you are actively connecting and posting. Once your name starts flowing out there (assuming you have the exp), people will just start offering you contracts.
  • Authentic Jobs I like this site a lot. Their interface is much cleaner than some of the other job search sites and while they had fewer contracts available, they were generally of a higher quality. In fact, I found the current contract that I’m working on here.
  • Simply Hired Although this site generally offlinks to other sites, I found it to be a good aggrigator of what’s out there.
  • Good Ol Google This seems like a job, but as I mentioned in my last post, it’s pretty easy to type “[:field_name] contract work” and come up with a pretty good list.

2. Tools For Managing Clients/Billing

As a new contractor, the concept of billing can seem a bit scary. You don’t want to look like a n00b, but you also don’t want to spend a lot of money. That’s where FreshBooks comes in.

I started using FreshBooks from day one and could not be happier with their service. Here are some of the pros:

  • Free for up to 3 clients. It says 30 day trial, but that’s just if you want more than 3 clients. So it’s perfect for when you are starting out.
  • Manage multiple projects for mulitiple clients with multiple tasks (‘nuff said)
  • Mobile app. You haven’t lived until you have sent an invoice from your smartphone. You feel super businessy. For an added bonus, send it from the gym, or your sailboat.
  • It handles sending invoices via mail or email automatically and reports back to you when the client has seen the invoice.

Again, FreshBooks is awesome! I can’t recommend it enough.

3. Tools For Ticket Management

This one is tricky, because every client is going to want to work differently. Here are the few I have expereinced thus far.

  • Pivotal Tracker This one is my favorite. It’s a very easy to use tool to help facilitate development in an agile environment. Even if you are not running the full scrum process, it’s still a valuable tool to simply track your progress. Your clients will appreciate it.
  • Basecamp You knew I was going to say this one. It’s an obvious choice because it’s obvioulsy a solid tool. I think it’s very valuable when you have a distributed team and need a central way to communicate.

Even if your client doesn’t use a tracker, I’d suggest you use one. It helps you to keep organized and get a better feel for how long certain tasks take (which you will need to know in future scoping).

I dont’ have a very long list here because I hate most tracking software. If you have some to add here, I would love to hear about them in the comments.

4. Tools For Software Development

I am an iOS and rails developer, so this section may or may not be applicable to you. Again, I put this out there to let you know what I am using and would love to hear what you are using.

iOS

  • XCode (duh)
  • CocoaPods – If you don’t use CocoaPods, you are doing it wrong. They are what gems are to rails and really help you manage 3rd party libraries.
  • GitHub – For verison control and code distribution amoung the team. (again, you know this already).

Rails

  • Sublime Text I was big on TextMate for a while, but now I use Sublime Text full time. It has some solid plugins and can do a smart autocomplete for any file type.
  • Heroku Deploying rails to production sucks. Heroku makes this process easy.

5. Tools For Communication

Working in a distributed team can be hard at first. Especially staying connected. Here are the major forms of communication that I use.

  • Skype Although Skype has totally gone down hill since the MS takeover, it’s still a free service that most clients will use. I’d suggest if you don’t have a Skype account, you get one before job searching.
  • Google Voice This service allows you to forward a number directly on your cell phone. It also has some nicities like screening your calls, voicemail, free calls, etc… It’s good to give out your Google voice number instead of your cell to clients as well as possible girl/boyfriends in case things go sour.
  • Google Hangout Skype falls short in one area (which happens to be their business model). If you have more than 2 people on a call, they must all have a premium account to do video chat or screenshare. Google Hangout gives you all of these features for free with up to 10 people as of this writing.
  • Standard social networks (Twitter, Linked In, G+) (duh)

Conclusion

Well, this post is already getting a bit out of control. I could go on and on. If I have obviously omitted a large section, please feel free to troll me in the comments and I will certainly add it.

I hope this has been able to provide you with some value, and I would love to hear your thoughts.

What I Learned In My First Month Being A Contract iOS Developer

tl;dr Present yourself to potential clients as if you have already made it. Don’t be scared, the work it out there. Freelancing FTW!1!

In the first week of December, I got a rather unfortunate (and unexpected) call from the CEO of the company I was working for. The gist of it was “we are reorganizing, and have decided to cut your position. Effective Immediately”. At this point, I was the Director Of Mobile Engineering and was making a very decent salary. While I was planning on leaving to go freelance at some point, I hadn’t dreamed it would be this sudden.

Well, it turns out that CEO did me one of the biggest favors of my life. He forced me to go indie. I probably would have flailed there for at least another year before even considering moving on.

I want to share a few things (good and bad) about what I have learned in the past month and how I will never (willingly) work for a company again.

Panic Sets In

I had been working at the aforementioned company for the past 4 years. In fact, it was my first job out of college. So, you can imagine how scary and stressful it was going from a steady paycheck to nothing in the blink of an eye. What’s ironic about this is, many people I have talked to since going indie have told me that they wish they could do it too, but really like the “security” of their corporate job.

At first, I freaked out a little and took the day off (I was “let go” in the morning). But, the very next day I hit the ground running in search of a contract.

Contracts, Contracts Everywhere

Much to my surprise, there are contracting opportunities everywhere. Again, I had to leave the company so soon, I hadn’t had time to research this myself beforehand. A simple Google search of “[your field] contract work” should reveal plenty (assuming your field is some sort of software. I can’t speak for other industries). I even started applying for salaried jobs as a contractor. You would be surprised how many companies are open to it.

This was immediately comforting.

Talk The Talk

My first few days of looking for a contract were pretty interesting. Being that I had just been let go, I felt this intense pressure to land a contract right away. This definitely came through in how I related to the recruiters and people I spoke with. My good friend Scott Caruso sat down with me and gave me some of the most important advice I would hear for dealing with potential clients.

  1. You are looking for the “right opportunity”. If you are considering freelance, you obviously feel you are an expert (or close to) in your field and that definitely has value. Don’t settle for crappy contracts at crappy rates just because you need the money. You will hate life.

  2. Spam! During my first week, I would contact one or two people and they said they would get back to me. Well, I didn’t want to possibly have to tell them no later, so I would politely not communicate with anyone else until I heard back. That was dumb.
    Finding contracts is like shopping at Goodwill. It’s mostly crap, but if you go through enough of the crap, you will find a gem.

  3. Leverage your existing contacts. This should be obvious. I was holding off on this early on as I didn’t want to sound lame. However, these are the people you can show a little desperation to as they are (or should be) your friends. That being said, someone always knows someone else that needs some work done. If I hadn’t done this, I for sure would have violated #1.

  4. You are a scarce resource (at least present yourself that way): Once I started telling recruiters that I was talking to tons of others and am planning on making a deal this week, I started getting a flood of them calling me back.

The Bad

  1. Everything you do starts to get a price tag. The other day, I asked my wife to make me a sandwichh. She told me to make it myself, and I politely informed her that the 15 minutes spent doing that would cost us $25 so it had better be the best sandwhich I have ever made.
I am not sure if this feeling ever goes away (if you are a veteran freelance, I&#8217;d love to hear your thoughts).
  1. It’s a little scary knowing you don’t have a paycheck in X months (X being your current contract length). This was the most frightening thing at first. Now, it seems like an exciting challenge.

  2. Tendency to overwork: Since you now have money++ and can make more just by adding hours, you will be drawn to work more. I have talked to many others who end up leaving freelance because of burnout from working too much. Sure you made $30K in 2 weeks, but you are hating life.

Summary

So far my journey as an independent iOS developer has been incredible. I am loving every minute of it and I encourage anyone interested in it to do the same. I don’t think it’s for the n00b or the non-self starter. This post I found on Hacker News has a brilliant step by step tutorial on moving in this direction.

I hope you have enjoyed yet another post on freelancing.

Thanks for reading!

5 Third Party iOS Libraries I Have Found Useful Lately

As I mature as a developer, I try to rely on other people’s code more an more. Why build something from scratch when a solution already exists that you can fit in your project. In Pocket MUD Pro, I used 13 3rd party libraries and am using quite a bit more in the project that I’m currently working on. I figured that I would share some of the libraries that I have been using so that it might save you some time in the future.

1. CocoaAsyncSocket

Link: https://github.com/robbiehanson/CocoaAsyncSocket

Many of my applications involve TCP or UDP networking. There is a lot of boiler plate code involved in every networked application, and CocoaAsyncSocket solves much of that for you.

2. Appirater

Link: http://github.com/arashpayan/appirater/

Screenshot

Hopefully, you have heard of this one or a similar library by now. It’s very challenging to get users to want to review your applications, let alone give you a positive review. AppiRater allows you to prompt a user to rate your application based on either number of launches or “significant events” which you specify.

3. Zip Archive

Link: http://code.google.com/p/ziparchive/

I try to ship small applications that download assets upon launch. A good way to send these assets over the wire is to zip them up and stick them on your server. I have written an article about this on iCodeBlog.

4. Quick Dialog

**Link: ** https://github.com/escoz/QuickDialog

Creating forms in iOS is pretty painful. It usually involves custom table cells and a lot of delegate nonsense. QuickDialog takes away some of this pain and allows you to easily create iOS forms. You can even design them using JSON.

QuickDialog Screenshot

5. TSMiniWebBrowser

Link: https://github.com/tonisalae/TSMiniWebBrowser

Often times, you want a quick and dirty browser in your application. I generally use it to point to in-app documentation or take the user to a page after tapping on a link. It’s quick and easy.

Screenshot

I hope you find some value in this list. I’d love to hear about the libraries you use frequently.

Happy Coding!

How To Become An Indie Game Developer

What programmer doesn’t want to be an indie game developer? A great article with tons of tips to help you on your way.

[Article Link]

My Number One Feature Request For iOS 6

Fix the Snooze button! I have no idea how this UI component got to Apple’s review team and they were like ”Yep, that looks beautiful! Ship it!”. If Apple changes the snooze button and slaps a 6 on iOS, I will be happy. If not, more rants to follow. Stay tuned….

If There Was Ever A Time To Submit A Show HN Article, It’s Right Now

Earlier today a post titled ”I Try to Up Vote Every ‘Show HN’ Post and You Should Too” made it to the top of HN.  It basically talked about people posting “Show HN” posts are putting themselves out there and the least we can do is give them an up vote.  Well, people are listening and as of this posting, there are currently 15 Show HN posts in the top 30.  That’s incredible.

So, if you have recently created something cool.  Head over to HN’s submission page and add your link making sure to add “Show HN” in the title.  You might get some great traffic/feedback out of it.

Lua Scripting The UI For Pocket MUD Pro

I have just updated my MUD client [Pocket MUD Pro] to be a universal library. It was surprisingly easy to add the iPad support as most of the application was comprised of UITableViews.

The main “MUD” view was the most challenging part as it contains a couple UIWebViews, UIButons, and a UITextField. However, I chose to do something I feel is pretty cool.

Scripting The UI With Lua

If I haven’t said it enough, I love lua. Especially in the context of scripting within other applications. Pocket MUD Pro already has complete lua support in triggers in aliases, so I figured I might as well apply that same logic to the UI.

Pocket MUD Pro has 3 core sections for the UI not counting the text input field. The main view (UIWebview), the prompt view (UIWebview), and the button bar (custom UIView).

One of the core challenges I faced on the iPhone, was resizing/reorienting all of these views on orientation change as well as when the keyboard was visible and when it wasn’t. To be honest, I spent most of my cycles getting this part right. On the iPad, I decided to things a little differently which improved the speed of my development overall and paved the way for future updates that will allow user-scripted UIs.

The UI Script

I want to start by showing you the lua code that is used to script the UI by default.

–MUD 
mudFrame = Frame:new("mud_frame") 
mudFrame.type = FrameTypeMUD
mudFrame.portraitFrame = {0,0,768,931}
mudFrame.portraitFrameKeyboard = {0,0,768,667}
mudFrame.landscapeFrame = {0,0,1024,675}
mudFrame.landscapeFrameKeyboard = {0,0,1024,323}
createFrame(mudFrame)

What’s happening here is, I have created a Frame class that has some properties (type, name, etc…) and injected it into the global lua space for use inside of the UIScripts. Then when the interface gets drawn, I reference the UI script for each of the MUD servers and use it to render the interface.

One interesting thing here is, I set the frames for each of the possible layout scenarios. Portrait, Landscape, with and without the keyboard. That way, when the keyboard hides/dismisses or the user rotates the device, I just reference the this script again and re-render the frame accordingly. This could have been achieved with auto-resizing masks however, it gets much more complex and things get tricky when you want to have a dynamic number of windows.

I follow this exact pattern for the button frames and the prompt frames. As you might have guessed, in a future release, I will open this script area up to MUDders and give the user the ability to script the interface however they would like. Some examples might be:

  • Dedicated map window
  • Dedicated chat window
  • Customized movement buttons
  • Customized backgrounds/borders/themes
  • Custom health/status/mana

Given this powerful UI Scripting style, a user will be able to create complex interfaces such as the one below from inside the app:

I still have a ways to go with exposing various functionalities via my custom lua bridge. But things seem to be moving along quite smoothly.

If you want to learn how I was able to bridge lua into my application, consider checking out my talk on lua scripting at 360iDev 2012 later this year!

Happy Coding!

Jailbreak iOS 5.1.1 With Absinthe 2.0 + More Watch Dev Coming

The GreenPois0n team has just announced Absinthe 2.0 allowing users of all iDevices (except Apple TV 3) to jailbreak iOS 5.1.1. This is especially good news for me as I can now continue development on my jailbroken app for the inPulse watch, iOS notifier

[Link URL]

Join Me At 360iDev 2012

I mentioned this on Twitter last week, so I might as well post it here to make it more official. My talk Making Your Games More Dynamic With Lua Scripting was accepted for 360iDev 2012! This will be my first official speaking engagement and I could not be more excited/nervous.

The Talk

I have had a huge interest in lua for some time now, especially as it applies to scripting games. In my last project, Pocket MUD Pro, I even embedded lua 5.1 and created my own bridge in order to allow players to fully script the gameplay. This got me very excited for the future as it was so easy to get lua up and running.

My talk will cover the basics of setting lua up in your own iOS projects. I will be using a simple tile based RPG (written in Cocos2D) for the demo and will demonstrate how you might use lua to script the behaviors of the NPCs as well as dynamically add new ones to the game. This opens up a whole world of possibility as you can now ship code over the wire and modify your game content without ever submitting an update to Apple.

It appears my talk has some pretty steep competition in its timeslot. There are two other incredible talks going on at the same time, so I’m starting to campaign for it now :)

Please comment on this post if you plan on attending 360iDev. I would love to connect with you.

[360 iDev Schedule]

Incredible List Of Popular Indie iOS/Android/Steam Titles On Sale

We believe that developers should have the freedom to price their games how they like, without interference from the online stores that sell the games. Why? Because it allows us to promote our games more freely, as we are doing here! We rely on the ability to promote our games for our livelihood and control over pricing is an important tool for this purpose.

Because We May is doing something very incredible here. They are a website to help you promote your game by listing it on sale. Any developer can submit their game(s) as long as they put it on sale for the given duration (May 24-June 1). There are currently some amazing games on sale including Osmos, Super Brothers, World Of Goo HD, and more.

[Games Link]

[Submission Link]

Why Facebook IS People

This is a very well written article detailing some of the inner workings of Facebook and why its business is YOU.  

I wonder when a distributed, self-hosted solution (like Diaspora</a>) will become popular.  Have you tried Diaspora or others?
</div>

The guide to implementing 2D platformers

http://higherorderfun.com/blog/2012/05/20/the-guide-to-implementing-2d-platformers/

An incredible guide detailing many of the tricks/design patterns used in 2D platformers.  Although there isn’t much code to look at, the higher level ideas detailed in the article are invaluable.

Pocket MUD Pro Is Now Universal + Promo Codes

I have just updated Pocket MUD Pro to support the iPad! In celebration, it’s on sale for $1.99 (down from $2.99).

Also, here are 10 promo codes for anyone who wants a free copy. Please comment on which code you take so others know which one’s are available.

9E3TF4XRLW97
RA6KFNTT9NEY
KN936MALLH7A
TLPMPXNTMMLL
RL7JNYFL4F7X
3RPAWMFTYY6F
4JYYJFH7HLKR
7XWETP3YP7JT
PN7XERXHH7ME
9R4NYX669FMJ
</p>

MetaWatch Announces iOS Support – Still Can’t Compete With Pebble

For those of you who have followed my blog for a while, you know that I am a huge geek for smart watches. I had the first version of what is now the Pebble (inPulse) and even hacked a jailbroken iOS app to interface with it.

MetaWatch has been around for quite some time now and looks *ok *, however their latest update appears to be completely in response to Allerta’s announcement/success of Pebble.

“We are delighted to be the first company to ship a Bluetooth 4.0 smartwatch compatible with both iPhone and Android platforms”

What is really concerning is the fact they they don’t mention anything related to how they are achieving iOS notifications. Pebble has been very upfront in stating that they are planning on leveraging ifttt.com to deliver complex notifications such as Twitter and Facebook. It leads me to believe they haven’t quite sorted everything out and are jumping to a press release in order to ride the smartwatch train.

I have a Pebble coming in August and intend on sharing my experiences as well as code. Perhaps I might scoop up one of these as well and write a comparison post.
[Article Link]

Great Introduction To Lua

(click the post title)

I have been using lua in my iOS applications for some time now. This tutorial provides a great introduction to a scripting language that most developers are very curious about. I really suggest spending a few minutes checking it out.

Why you Should Check Out Unity

A while back, my buddy seantron showed me some of his 3D games he’d been working on including this one. My initial reaction was “how the heck did he get the chopps to do that?”. While, Sean is an incredible developer with a ton of creativity, doing things like loading models, texture mapping, or even basic 3D projects are flippin hard.

A while back I tried my hand at 3D and made sort of a basic Minecraft style game from scratch using OpenGL ES. Let me tell you, it was brutal (and I have been coding for almost 10 years). This project took me a week or so to ramp up, get basic cubes and textures going and a simple first person view.

Enter Unity

Sean had mentioned to me that he used this 3D engine called Unity to create his games. While I had tried XNA, I had never heard of Unity and figured it was similar (basically a framework with some convenience methods for loading models, mapping, etc…). Boy was I wrong…

Unity 3D is more than just an engine. It is an application that allows even the most novice of developers to create beautiful, rich, 3D games. I’m serious. Check out this demo below of an app I made in unity in about 3 hours using this tutorial. The crazy part is, I wrote almost no code. Much of the interactions and game were developed using drag and drop and free assets.

Link to my awesome game

Getting Started

I was very reluctant to learn Unity at first as the interface appears to be a bit daunting. However, once you check out a few tutorials, it becomes second nature. Here are a few places to get started:

InfinitAmmo’s Unity 3D tutorial series – This was where I first began. He does a great job at going over the basics of Unity while keeping things interesting.

Getting Started With Unity on Active Tuts+ – This is where I made the game you checked out above. Take an hour and do the first in the series, you will be very surprised with the outcome.

Unity 3D tutorials – Unity has a wealth of information and demo projects on their website. They come with the source and comprehensive PDFs detailing various aspects of each of their demo games.

After completing at least the top two series’, you should have enough knowledge to begin hacking on a game of your own. I know that I do :)

Conclusion

I hope this has been enlightening and I really urge you to check out Unity.

Happing Coding!

Unity 3D’s Website

This post is part of iDevBlogADay, a group of indie iOS development blogs featuring two posts per day. You can keep up with iDevBlogADay through the web site, RSS feed, or Twitter.

I Suck At Blogging (Lately)

OK, so the title isn’t entirely true (I have maintained quite a few blogs in my day). But, one thing is for sure, I have sucked at blogging lately. So much so, I just had to think hard about having to bold lately using markdown in the previous sentence #meta.

Burnout

I was blogging very consistently for the Envato Network on their Mobile Tuts Plus as well as on iCodeBlog and here. Eventually, I got burnt out and gave up blogging on every blog (for the month).

What happened was, I was blogging to make money (Envato pays $250/post!) and no longer for fun. This sucks and I was missing deadlines and writing crappy content which needed much revision.

New Plan

Write here only (for fun!) and infrequently on icode if time permits as I can do that during work time 😉 That being said, expect to see more content here for better or worse. Once a week is the new goal.

Shutup

That’s what you are saying to me. I hate these “Sorry I haven’t been around in a while. I promise to post more” posts that are usually the last posts on a blog for like 5 years just as much as you do. Let’s hope that’s not the case here. You will just have to trust me and subscribe.

Also, I have a sweet new theme from Jekyll Bootstrap.

Pocket MUD Pro Released + Promo Codes

I am very proud to announce a brand new version of my Pocket MUD Pro application for iPhone. I have been working very hard to make a perfect MUD client that is suitable for hardcore mud players, visually impaired mud players, and casual mud players.

Here are some of the features:

  • Support for all orientations
  • Full ANSI color support
  • Dedicated prompt
  • Zoomable Text View
  • Perfect rendering of MUD text (check out the maps)
  • Very fast
  • Hides Telnet codes from the user (unlike every other MUD client)
  • Autoconnect on startup
  • List of MUDS
  • Favorite List
  • Unlimited Command history
  • Quickly cycle through command history
  • Triggers using the lua scripting language
  • Text Command Alias
  • Lua scripted aliases
  • Timer Support
  • Background support. Stay connected for up to 10 minutes after you close the application.
  • Support for multiple commands separated by semicolons
  • Comes packed with a list of some of the most popular muds
  • In-App Documentation of triggers and aliases
  • Ability to play sounds when triggers fire
  • Ability to gag extraneous text, which is extremely helpful for visually impaired players.

Promo Codes

  • PXYTRKLTWL46
  • KTXAAMYNYXPP
  • 443433YNJX4E
  • 9K99KJWRXNYT
  • W44YHPHLRFMT
  • 4HYHLEFXYYN7
  • 4HK74JLMMHAA
  • KX6XJ79TLWFP
  • 437YTX9KLEN9
  • 7YAMYF4EYALF

Please leave a comment here if you use a code to notify others that it’s been taken

Download it here

I’d love to hear what you guys think about the app.

Happy MUDding!

Vim For iOS Is Incredible

I used to be an Emacs guy and would battle to the death on the war between Vim and Emacs. It wasn’t until a coworker of mine sat down and really showed me just how cool/simple/powerful Vim can be. Just using Vim is a new adventure every day and has really improved my productivity. I now use it to code, blog, and even jot down quick notes.

Last week, I saw on Hacker News a link announcing Vim has been ported to iOS. I have spent a week or so with it and can honestly say the port is almost perfect!

It has most of the major Vim features and commands including:

  • Automatic indentation
  • Visual mode (block operations)
  • Language-aware syntax highlighting
  • Integrated scripting language that lets you extend functionalities
  • Macros recording and playback
  • Markers management (to quickly move around the edited file)
  • Multiple clipboards

You even have access to the config file to remap keys and define your own custom macros.

There are a few features that would make this better on mobile however:

  1. Dropbox Support – Currently you must use iTunes to work with Vim documents on mobile. There needs to be an easier way to share these.
  2. Keyboard bar – Since you have to switch modes so frequently and there are some keys you type often ( “:” ), it would be nice to have quick access to these.
  3. Plugin support – This is an Apple limitation :(
  4. NERDTree – The file browser that’s built in doesn’t work too well.

With Vim mobile, you can now look even more nerdy on your iPhone 😉

Download Vim For iOS