industry outlook series: mobile development for landscaping

To continue our market assessment series of seemingly tech-neglected industries, we’ve decided to share with you one we’re all too familiar with: landscaping.

TLDR: Landscaping is a highly competitive and highly fragmented industry. With >100,000 firms (most with less than 4 employees) in the US generating, and each generating, on average, <$1MM in annual revenue, lawn care and lawn design is quite the niche for the motivated indie developer. The key development principles should be: low-cost, standard-setting, and social.

Landscaping… huh?

We get it. In many cases, landscaping is hardly noticeable. Good landscaping is, more often than not, over-looked and taken for granted. In fact, we admit wholeheartedly that we typically only notice extreme cases on either end of the spectrum. Eccentric, extravagant, or neglected landscaping is typically the few times we appreciate the importance of lawn care. We find this pretty surprising, however, given that the superficial nature of lawn care is nothing less than marketing. And marketing is everything.

The sexy in the not so sexy industry

Unlike our previous assessments of oil and gas and trucking, the barrier to entry to landscaping is low. Any high school kid with lawnmower can (and has) become a successful lawn magnate. In fact, there are are over 100,000 lawn care companies reporting over $100B in revenue in 2020. Even more, of these 100,000 firms, roughly 70% are run by 1-4 employees.

The unique structure of the landscape business presents an incredibly attractive opportunity for the mobile app developer, and more specifically, the indie app developer. We’d go as far as to say that during the COVID-19 pandemic, landscaping has more than likely been spared (or at least much less impacted than other service providers). It’s our opinion that this is due, in large part, to the socially distant nature of the business and the fresh air of the outdoors.

Decentralization is the name of the game

How do you capitalize on a highly competitive and highly fragmented industry? Given most of the >100,000 firms in business generate <$1MM in annual revenue, how do you go about even wrangling such a decentralized industry? Our assessment is as follows:

  • Focus on low-cost: These firms are price sensitive. When framing your product, keep in mind that while these firms are less willing to spend money, they WILL spend on products that provide a visible return.
  • Standard-setting: Given the highly fragmented market, don’t over design for a given niche. Design for common issues of lawn care professionals.
  • Social: Any application should consider a social aspect. The industry is highly decentralized and an attempt to provide connections between disperse nodes (i.e. firms) is paramount.

Brainstorm with us

Now that we’ve set the stage for developing for this industry, let’s discuss some example app ideas (take them and run with them, please!).

  • Workforce planning – job board for allocating resources. Think gig-economy for landscaping companies and customers alike.
  • Equipment sharing – how can I lend idle equipment or trailers to other firms?
  • Crowd-sourced design – landscaping is highly creative; how do we leverage the collective designer brain to drive new industry trends?
  • AR plant prototype – leverage augmented reality to preview interior or exterior designs.
  • Sustainability – Public green house inventory to move product and reduce waste. Allow nurseries to publish inventory in real-time.
  • Sun exposure – Reminders for sun safety. Skin cancer is a threat to those who spend most of their time outside. Prioritize safety.

Wrap-up

To wrap things up, we’re excited about landscaping. The highly competitive and highly fragmented industry is perfect for an indie developer looking to jump into something new. We’ll leave you with one last opinion – focus on green technology. The industry appears to be trending toward more eco-friendly and less water-intensive alternatives. How can your application satisfy the increasing hunger for sustainability?

Let us know how we’re doing. Contact us or comment below with anything you’d like to see. We’re all ears!

stress about your early career

The following article was written by a colleague reflecting on their early career


A fraction of a fraction of advice is impactful

We hear it time and time again. The unsolicited advice we get from our peers and our mentors regarding our early careers. Most of this advice is decent advice. But decent advice isn’t going to get you anywhere. More than that, this advice isn’t impactful – can you recall any of the advice that you’ve received in the past 12 months? I’d wager that most can recall a few things. Of those few tidbits, you’ve probably taken to heart a fraction.

So, a fraction of a fraction of this advice is meaningful. How much of this advice is in the form of consolation when you screw up? You botch a technical presentation or score a poor performance review. You vent to your friends and your mentors. Usually, and naturally, you’ll get affirmation that it’s not your fault. Or that there’s a misunderstanding. Or… or… [insert excuse here].

When I say stress, I mean it

I’m not saying that this is bad. In fact, I’d argue that this serves a necessary social function. But don’t let that get in the way of learning from your mistakes (if that’s what you want to do). If you have aspirations to own your own organization, work for yourself, climb the corporate ladder, or any combination, you’ll need to experience self-advice.

When I say self-advice, I mean a lesson that you’ve truly reflected upon and internalized. That poor performance review – dissect it. Sure, there could be a misunderstanding with your boss or with your colleagues, but what’s the source of that misunderstanding? Honestly, getting critical feedback from a performance review is pretty rare. So I’d take that and run with it.

Make a lot of mistakes early on

I can’t emphasize this next point enough: MAKE A LOT OF HONEST MISTAKES EARLY ON.

Seriously. Mess up big time. Embarrass yourself. I don’t mean act like a jerk and behave like an animal. I mean, work at 100mph and with total confidence. Speak up and screw up. What I lacked most in my early career was confidence. Of course I didn’t know the material. I was cautious in my approach. I didn’t make many mistakes because I didn’t take any risks. I missed out on learning opportunities.

Early on in anything, you have to stress about it. Yes, there’s an optimum level of stress that provides a balance of drive and motivation. What I mean is, you have to:

  • Take risks
  • Make mistakes
  • Stress over them
  • Learn from them

To me, stressing over these mistakes looks like listening to criticism and feedback (constructive or not; just listen) or assessing your feelings of embarrassment and failure.

A mistake or failure is an opportunity. Take inventory of them. Reflect on them. Write about them. Objectively dissect them.

That’s what stressing over my early career should’ve looked like. We always hear that the road to success is paved with failures. I try to take that literally. The more mistakes I make, the closer I am to succeeding in what I truly want (which is a topic of discussion for another day).

Take it personal

Yes, take it personal. You’re not doing nearly enough to learn from the ample opportunities found in your mistakes. Trust me. If you’re in your early career or starting something new for the first time – take the time to screw something up while moving at 100mph and with 100% confidence. It’ll be worth it.

industry outlook series: mobile development for trucking

Lifeblood of the economy

It’s arguably indisputable that the trucking industry serves an invaluable purpose in our modern economy. In fact, the old adage, “if you bought it, a truck brought it”, underscores the ubiquity of the industry. Agriculture, food, crude, and retail (among countless other sectors) rely extensively on the vast network of our trucking-supported supply chains.

More than 3.5 million drivers are currently in service (not to mention the countless support staff involved in maintenance, logistics, and rest stops). And of these, a significant portion are owner-operators, meaning these drivers are small business entrepreneurs. What we’re getting at is the employment block is massive and ripe with opportunity.

Significant industry issues lead to mobile app opportunity

It’s been our experience that truckers are one of the most tech-savvy and well-read groups. The industry demands it. Obviously, these men and women spend a significant portion of their lives on the road. This time spent driving is typically spent listening to podcasts, audiobooks, and, more often than not, self-reflection.

How many of us non-truck drivers look forward to taking long road trips as an opportunity to get away and think? We definitely do. Given this aspect of trucking culture, we can envision a number of opportunities to develop meaningful applications to not only solve non-trivial industry issues, but to also enable the sharing of these insights with the general population.

Before jumping into mobile app opportunities, we want to bring to light a few problems facing the industry as a whole:

  • Safety
  • Low driver retention due to wages, lack of ownership, and disruptive regulation
  • Time away from family and friends
  • Uncertainty in the future

These issues (and more) contribute to an industry wrought with a significant labor shortage (even pre-COVID).

Ideas for mobile applications

While trucking might not be the most sexy industry for which to develop mobile applications, the potential prize makes it one worth considering. Even more, the apparent lack of focus enables a less-competitive landscape with respect to software development.

Example applications to spark your innovation (take these and run with them):

  • Safe driving – connect truckers with regular drivers; truck traffic, stalled vehicles, alternative routes
  • Augmented reality field and service manuals
  • Social network of road reflections – the general public would benefit from driver thoughtfulness
  • Truck stop reviews and facilities reservations
  • Podcast, audiobook, and radio sharing
  • Gig-style job locator for owner-operators
  • Crowd-funding for driver-led projects (increase ownership and leverage entrepreneurial spirit)

We believe that developers are vastly underestimating the potential for virality. The >3.5 million drivers (and countless support staff) are bound by a common culture. Successful ventures will undoubtedly spread quickly, and the culture of loyalty will increase switching costs to competitors.

About the industry outlook series

We’re always sharing freely the ways in which you can get involved in industries that are typically neglected by trending social media. These ideas are distributed as a way to spark innovation and potentially fill technology gaps. If you’d like us to explore another industry, please reach out to us at social@noworrieslifestylebrand.com (or comment below).

If you enjoyed this read, check out our industry outlook of the oilfield.

teams: cultivate a culture of ownership

Do you enjoy your current role?

Think about this question beyond the surface. Are you content in your current capacity? Have you always been content in the roles you’ve held? We’d imagine you’re reading this quickly and brushing off the questions. Perhaps you’re perfectly happy, or perfectly unhappy. We doubt that’s all there is to it.

Humor us for a bit. Grab a pen, keyboard, or stylus and take a 15 minutes to reflect. We’ve discussed the power of writing in a previous article, however, a key theme here at @nwlbrand is repetition of foundational principles. Again, take a few minutes to answer, in an exhaustive and stream of consciousness manner (i.e. write words as they come to you without proofreading) the following questions:

  • Am I content in my current capacity?
  • What would I change about my role?
  • What decisions have I made about my current role that I would change?
  • What do I think would happen if I had the opportunity to make these changes?
  • What changes are within my power to make?

Regardless of your opinion of your position, positive or negative, you should routinely take inventory of your condition. Analyze your team and your network. The outcome of this process is a leading indicator of future performance.

Forever a student and teacher

You’re never done learning and you’re never done teaching. Whether or not you recognize your influence on impressionable individuals, the impact is real. This dichotomy of perpetual learning and teaching is paramount to making sense of the present.

This brings us to the crux of the article – cultivating a team culture of ownership. This culture is the result of the countless interactions between team members. The dynamism is complex and an almost natural phenomenon. Recognizing this dynamic allows us to focus on the base unit of this culture – the individual. A culture of ownership is one in which the individual is prioritized and the individual feels as though they own the success of the organization.

Skin in the game

Now think back on your writing exercise. Now think about the Silver Rule (“do not do unto others as you would not have them do unto you”). Encourage intentional self-reflection, spontaneous activity and individual passions, and, most importantly, the feeling of purpose. Excavating purpose in your role and for your team will result in skin in the game. As a team member or leader, you require something significant to lose in the event the team fails (and something significant to gain if the team succeeds).

An example

Recently, one of our developers requested he share one of his past reflections regarding his previous role at a large corporation (these reflections are encouraged to be kept secret to avoid any external pressures). His previous position was exhausting. He was living “cash to bank” and felt no ownership in his role. He worked hard, but only did what was minimally required of him. He eventually built what he was lacking, ownership. He was missing the opportunity to build what he wanted and when he wanted (within reasonable expectation of his obligations to his employer).

Working in a team without a culture of expression, spontaneity, and purpose will lead to burnout and de-motivation in one’s personal life. He carries with him now an entrepreneurial attitude and we actively encourage this expression of creativity. We try to honor the silver rule and don’t stifle what we wouldn’t want stifled, that is ownership.

In any case, we wrote this article in response to his passion for silly-fun projects. We wanted to showcase his side-project as we find it an incredibly valuable example. Check out the preview below! Coming soon to the Apple App Store – Squirmy Worm!

https://twitter.com/nwlbrand/status/1276141132288872448?s=20

Closing

We won’t drone on and on about something most likely to be disregarded as trendy common sense. What we’ll leave you with is the importance of encouraging time of written self-reflection in your team. In turn, consistent reflection will lead to a strengthened mental fortitude and more intentional interactions. In the end, this will build a foundation for ownership.

indie iOS developer toolkit

Where do I start?

We’re frequently asked by fledgling developers, “where do I start?” and “what do I need?”. It’s a tough question to answer given everyone has different learning preference. That being said, we have come to realize that we send a pretty standard response. Whether our clients are interested in taking the plunge, our friends are curious about the inner workings of mobile software design, or the casual Reddit user asks for insight, we’ve found ourselves giving a similar response.

Well, okay then. What’s that response?

We’ll cut right to the chase. Our go-to list covers our favorite resources for the new indie (and cash-strapped) developer. We’ve personally used these tools and have grown so fond of them, that we still use a lot of them (in lieu of commercial grade software).

Our List

  • Learning Swift (or any other language, for that matter)iOS 13 & Swift 5 – The Complete iOS App Development Bootcamp by App Brewery on Udemy. We speak about this in our write-up on the perfect time to learn a new skill.
  • GitHub – This one is obvious, but we’d be remiss if we didn’t mention it. Get source control! While Xcode has a local repository, remote source control is imperative.
  • 2D graphics – We really like pixel art. It’s quick, easy to pick-up, and lightweight. We’d recommend starting your 2D graphics journey with one of the numerous apps on the App Store of your choice. We’ve had good experience with Pixel Studio.
  • 3D graphics – Just as we recommended pixel art for beginning graphics design, we’d recommend voxel art for 3D resources. Check out Magica Voxel to get started!
  • Text editors(-ish) – Thought we’d mention that we’re big fans of Atom for editing most text files (excluding Swift files). We also leverage PLIST Editor for working with property lists.
  • App Icon Generator – A nifty tool to convert your app icon to the required sizes.
  • GarageBand – The stock Apple app is perfect for creating your own loops and one-shot sounds. While it takes some time to master, you’ll be amazed by what you can generate quickly.
  • Splice.com – In the event you’re not interested in learning a new (virtual) instrument. Splice has you covered. The 100% royalty-free for commercial use audio is great for DJs and app developers alike.

That’s not enough!

While having the right toolset certainly makes the job easier. You can’t accomplish much without a community. Be sure to find other like-minded folks who share your passion for development and design. Reddit is perfect for this. Indie Hackers is great too.

Similarly, marketing is everything! Don’t neglect graphic design. While advertising is out of scope for this article (stay tuned!), it can be incredibly helpful in sparking interest and getting your brand out there.

Finally, remember to pay it forward. Once you get going, you’ll pick it up quickly and will then share in the efforts to educate the newcomers.

What’re your favorite tools? We’re always eager to try out new things.

wwdc 2020

Key Updates

We wanted to bring you a quick and concise list of the updates from WWDC 2020. We’re excited about what’s to come (especially the on-device ML; hoping this is opened up to developers – tired of using externally trained models!). The key themes:

  • Privacy
  • “Keeping the context”
  • Ease of use and standardization

The ecosystem feels more integrated and device-agnostic. Overall, we really like it! Our thoughts are with Intel, haha. Take a look below for the highlights.

iOS 14

  • App Library
  • Widgets (homescreen + smart stacks)
  • Picture in picture
  • Siri redesign – reference on-screen info!
  • Translate – on device learning
  • Messages
    • Pinned conversations
    • Memoji & memoji stickers + aging
    • Groups – inline replies + mentions
  • Maps
    • Guides
    • Cycling/EV routing; eliminate “range anxiety”
    • Alternative routes, congestion tracking
  • CarPlay
    • Digital keys
    • Sharing via iMessage
    • Industry standard
  • App Store
    • App Clips – get the apps you need; only when you need them
    • Small; portable version of apps – can easily download full version later
    • <10 MB in size

iPad OS 14

  • iOS + add’l capabilities; mostly visual tweaks
  • New trackpad
  • Apps residesigns
    • Music
    • Calls
    • Sidebar
  • Search
  • Pencil refresh
    • Handwriting as “powerful as typed text” – Scribble to iPad
    • Handwriting converted to text
  • On device processing

AirPods

  • Seamless device switching
  • Spatial audio for AirPods Pro

Apple Watch

  • Workout, cycling, dance
  • Sleep + bedtime routine
  • Hand washing
  • Preventative health is core theme

Privacy

  • Data minimization
  • On-device processing
  • Apple sign-in
  • Share approximate location
  • Recording indicator (mic or camera use)
  • App privacy
  • Summary of app’s privacy practices – like nutrition label

MacOS Big Sur

  • Visual redesign
  • App redesign – maps. messages, etc
  • Again, the theme here is device integration “keepig your context”
  • Catalyst update

Apple Silicon

  • Universal
  • Rosetta
  • Parallels
  • Third party app updates (Microsoft Office, Adobe)
  • Metal API
  • iOS and iPad OS on macOS

Other

  • Home
  • Apple TV
    • Device integration, Xbox controllers, Foundation!
  • Safari Extensions

Wrap-up

Best conference yet! Very excited about the transition to Apple Silicon. Developers should be incredibly satisfied. Looking forward to what comes next! Hope you found our no-BS takes useful. Stay tuned for more updates from this week’s conference!

importance of documentation

Image by Ylanite Koppens from Pixabay

“Comment” on the journey

When was the last time you stopped to give pause and to reflect on where you’ve been and how you’ve arrived at the “now”? Yes, discipline in providing detailed code commentary and in crafting descriptive git commits is critical to the success of any coding project, however, that’s not what we’re getting at here.

While certainly analogous to project documentation, what we’re discussing here is keeping a written log of your journey. Whether you’re an aspiring business owner, established entrepreneur, or independent free lancer, you owe it to yourself to take inventory of your progress. Lessons learned are best recognized in written word. The power of writing has long been tied to an improvement in critical thinking skills.

Pick up a pen (or keyboard)

Where are you right now? How did you get here? What would you do differently or do the same? Answer tough, open-ended questions. Write until you’re exhausted – don’t worry about punctuation, spelling, or grammar. Focus instead on writing in a stream of consciousness fashion until you’ve expended all thoughts.

Start small. Reflect on the past day or the past week. Describe deeply how you’re feeling in the moment. This is real history. Recording the progress you’ve made with regard to assessing your feelings of doubt, motivation, failure, and success is a key, leading indicator of future performance.

Pick up a pen or sit down at a keyboard. Start writing for 15 minutes. Do this daily. Build the habit of reflecting.

Write for you

Write for yourself. This doesn’t have to be shared. Give an honest assessment of your progress toward your goals. To be honest, you don’t even need to reread what you’ve written. We’d argue that the process is more important than the content.

That being said, sharing your insights is invaluable. Whether you’re sharing them with friends or writing to the vastness of the web, your unique insights and experiences are bound to resonate with an audience. Think of how differently our professional experiences would be if more wrote about their often-deemed “mundane” jobs (improperly categorized as such). Sharing personal reflections of daily learnings and observations in the workplace is invaluable to students (and we’re all students regardless of life stage).

Questions to ponder

We’ll finish by leaving you with a handful of questions to spur thought. Don’t feel pressured to answer every question. Create your own. Again this is more about exhausting your stream of consciousness and less about content.

  • What have I accomplished today (“nothing” is also an answer)?
  • How do I feel about what I’ve accomplished?
  • What decisions would I change if I had the chance?
  • What do I think would be the results if I had the opportunity to change those decisions?
  • What did I learn in the process?
  • What do I want to work toward?
  • How do I feel about my decisions and my path going forward?

We hope that you’ll take the time at the conclusion of this article to reflect on the previous day. While we obviously can’t force you to make a habit of it, we’re hopeful that you’ll entertain the idea.

graphic design for the new indie developer

Image by Lukas Bieri from Pixabay

Coding is the easy part

If we’re honest with ourselves, we’ll admit that coding most software is much easier than the more creative aspects. How many of us seem to effortlessly implement new features, but neglect the user interface and interaction? We’ve definitely fallen into that trap. Even more, as programmers, we tend to devote a disproportionate amount of time to writing code, testing, and fixing bugs than we do to streamlining the interface and creating graphics.

We’d argue that in many cases, taking the time to draft out the user interface and design can eliminate many of the tedious coding tasks that we find ourselves in. We can even do away with the late-night hours developing a complicated feature that wouldn’t even be necessary with intuitive and beautiful design.

It’s hard to be creative

We’ll be the first to admit that we’ll find ourselves neglecting graphic design. In fact, many of our clients are interested more in implementing their grand functional vision (especially when it comes to internal, enterprise applications).

It’s funny because all we hear is the now, almost old adage “marketing is everything”, however, we tend to totally throw it out the window when it comes to execution. We totally get it though. In our case, when we first started out, we were only technically savvy. We didn’t even know how to design graphics for our games and our interfaces. It’s an intimidating task.

Getting started with design

Our recommendation to the indie developer (more specifically, the indie game developer), is to dip your toes into pixel art. It’s a friendly introduction to graphic design and it goes a long way to making your applications look polished.

Backgrounds, buttons, and even animations are incredibly easy to whip up in no time. We’ve always been intimidated by the professional graphic design software. The cost and the learning curve is high (and subjective). But like most other skills, devoting the time (and building habits) will reap rewards (e.g. more app downloads!).

Take a break from coding and start designing

To wrap up, after finishing this article (and sharing it!), jump on the App Store of your choice and download one of the pixel art apps. Stop neglecting what you’ve put aside for tomorrow and start designing basic graphics. Even the most simple design will improve the look, feel, and ease of use.

We’ve used Pixel Studio on iOS extensively. And while it’s notoriously clunky, the results are excellent. Anyway, we’ll let you get to it!

If you like this article, please comment below! Any and all feedback is greatly appreciate. Stay tuned for another simple (no-BS) write-up on app wire-framing and UX design!

industry outlook series: mobile development for the oilfield

Economic climate demands near-perfection

Every now and then we’d like to take a step back from explicit Swift discussions, and dive into our assessment of opportunities in industries that don’t get much attention. The aim is to provide you with ideas outside of your current frame of reference. This week we’d like to discuss a unique opportunity for mobile development – the oilfield. The following article is brought to you by our energy-focused, sister organization – petrolytic.

For most, the thought of the oilfield brings to mind images of heavy machinery and barren deserts. While appropriate, operations are becoming increasingly digitized with an obsession for tech buzzwords of the month: machine learning, big data, artificial intelligence, etc. You name it; the industry is interested. In fact, operators and oilfield services companies of all sizes are desperate for ways to improve safety, mitigate environmental impacts, and make step-changes in efficiency. The current economic climate and public opinion demands it.

Environmental improvements and efficiency gains are not mutually exclusive

There’s no doubt that green tech and renewable energy is trending; and for good reason too. This doesn’t mean, however, that petroleum products are going away. A transition appears to be inevitable, but it’ll take quite a bit of time (barring some black swan event). In any case, there exists a number of opportunities to “greenify” the oil and gas industry and make it more palatable to the masses. Efficiency gains and environmental improvements are not mutual exclusive. As oil and gas professionals, we’ve always felt we had the responsibility to be good stewards of our land. This brings us to the crux of the article – mobile software for the oilfield.

Many might not know that exploration and production companies, as well as, oilfield services companies have significant R&D spending. Even more, many have dedicated VC funds aimed at the next big innovation. In our opinion, there exists ample opportunity to create value for all stakeholders (mobile app developers, oil companies, civilians, shareholders, state revenue… on and on).

Oilfield app ideas

For example:

  • Improving safety (oilfield priority #1) by implementing a mobile notification system to alert of workers of possible incidents.
  • Applying models on mobile devices to diagnose well issues and improve well surveillance.
  • Reservoir simulation should be available on a mobile device (even if the computations aren’t performed on-device).
  • While obvious, how about a gig-economy setup for truckers, hotshots, and frac crews?
  • AR possibilities are endless: training crews, virtual equipment/process manuals, and even surface facilities layouts

It appears to us that much attention is given to the hot sectors: biotech, social media, and the gig-economy. And while attention given to these sectors, other industries are neglected. Our take is that competition is lighter in this industry.

In conclusion, while the oil industry is moving in the direction of tech innovation, it’s incredibly lacking as a whole. The industry is craving more attention and more creative thinkers. While you might not agree with fossil fuels use, providing the means to improve the value chain is undoubtedly beneficial to all stakeholders.

For more posts like this one, please subscribe to our energy-focused newsletter at petrolytic.

swift 5: gamekit leaderboard

Games on the Apple App Store are abundant. We all know this. That’s why it’s imperative to put on your competitive hat and face the action (a little marketing never hurt also). What better way than to introduce some social dynamics to your game via a competitive leaderboard?

We’ve been busy developing a new game and find it incredibly easy to implement basic social functionality using the native Apple Game Center (with GameKit). Most games use this to some extent, so we wanted to share with you all a quick way to implement a GameKit leaderboard.

For reference, GameKit is the framework that allows us to interact with Apple Game Center. You can read more about it in the Apple Developer Documentation.

Before we get started, we wanted to outline the steps at a high level:

  1. Enable GameKit in your Xcode project
  2. Create a Leaderboard Identifier on App Store Connect
  3. Write some code to read and write to Game Center

Very straightforward. Let’s dive right in.

Enable GameKit in your Xcode project

Start by opening your application and verifying the bundle identifier. To enable GameKit, all that’s required is to click the ‘+ Capability’ button on your target. The steps are illustrated in the image below.

That’s it. Your application is set. Let’s set up the leaderboard in your App Store Connect account.

Create a Leaderboard Identifier

The next step is to create a unique leaderboard on your App Store Connect account. Go through the process of creating an app. Once finished, navigate to the Game Center tab under Features. Click the ‘+’ next to Leaderboard, select a single leaderboard, and populate the required information. We use the com.companyname.appname naming convention for our in-app purchases and Game Center content. Make note of the leaderboard ID as we’ll need to reference it when querying from our application.

Write the Code

The final step is to implement the necessary lines of code. What we want to accomplish:

  1. Authenticate the user with Game Center – Apple suggests we do this immediately
  2. Track a scoring metric and posting the high score – we need to track something (we’ll use a high score for this example)
  3. Load the leaderboard – we need a way to display the leaderboard results

It’s not too difficult to implement, however, there are a few hiccups that can occur along the way, which we’ll discuss below.

Authenticate the user with Game Center

Let’s start by authenticating the user when our root view controller’s view did load.

class GameViewController: UIViewController {
    
override func viewDidLoad() {
        super.viewDidLoad()
        authenticatePlayer()
    }

    func authenticatePlayer() {
        if SWGameManager.sharedGameDataManager.gameCenterDisabled == true {
            presentGameCenterDisabledAlert()
            return
        }
        
        let localPlayer = GKLocalPlayer.local
        localPlayer.authenticateHandler = { (viewController, error) -> Void in
            if ( viewController != nil ) {
                self.present(viewController!, animated: true, completion: nil)
            } else if GKLocalPlayer.local.isAuthenticated == true {
                SWGameManager.sharedGameDataManager.gameCenterDisabled = false
                print("Player is authenticated!")
            } else {
                SWGameManager.sharedGameDataManager.gameCenterDisabled = true
            }
        }
    }
}

This is all the code it takes to authorize a user. The SWGameManager code manages additional app-specific metrics (game mechanics, etc), however, the gameCenterDisabled property is one we’d recommend. For whatever reason, if a user declines to log in to Game Center multiple times, the authenticateHandler method won’t be called anymore. This requires the user to go into their general settings and enable Game Center manually. We track this with a flag and then notify the user if their Game Center is disabled.

Track a scoring metric and posting the high score

If you’re developing a game, then chances are you’re tracking some sort of score. When it comes time to sending the score to Game Center, then you’ll need to implement some variation of the following code:

    func postHighScoreToLeaderboard() {
        if GKLocalPlayer.local.isAuthenticated {
            print("\n Success! Sending highscore of \(score) to leaderboard")
            
            let scoreReporter = GKScore(leaderboardIdentifier: Constants.kGameKitLeaderboardID)
            
            scoreReporter.value = Int64(SWGameManager.sharedGameDataManager.highscore)
            let scoreArray: [GKScore] = [scoreReporter]
            
            GKScore.report(scoreArray) { (error) in
                if error != nil {
                    print("An error has occurred:")
                    print("\n \(error!) \n")
                    self.delegate?.postToHighScoreLeaderboardDidFail()
                } else {
                    self.delegate?.postToHighScoreLeaderboardDidSucceed()
                }
            }
            
        } else {
            self.delegate?.localPlayerNotAuthenticatedToPostHighScore()
        }
    }

What we’re doing here is:

  • Verifying that the user is authenticated
  • Creating a score object using our leaderboard identifier (the same one we used to create the leaderboard on App Store Connect)
  • Reporting the score and handling the output

We rely on delegate methods to handle the different outcomes (the functions labeled self.delegate?). These aren’t necessary but are definitely convenient.

Load the Leaderboard

Finally, it’s time to display the leaderboard. This is incredibly straightforward. All that’s required is to use the following code and implement the required delegate method.

    // Present the leaderboard scene
    func presentHighScoreLeaderboard() {
        if SWGameManager.sharedGameDataManager.gameCenterDisabled == true {
            presentGameCenterDisabledAlert()
        } else {
            let leaderViewController = GKGameCenterViewController()
             leaderViewController.gameCenterDelegate = self // Make sure to implement the delegate method
             leaderViewController.leaderboardIdentifier = Constants.kGameKitLeaderboardID
             self.show(leaderViewController, sender: self)
        }
    }

Wrap up

That should do it. Now use a sandbox Apple ID to debug! While this was a relatively simple exercise, Game Center is much more powerful (e.g. tracking player achievements, sharing leaderboards, etc). Check out the Apple Developer Documentation for more information and stay tuned for additional write-ups!