This brand new web service from Apple allows us to declare and edit our activities outside of our app.

Now teachers will see your activities without having to open your app first, and you can change them without pushing out an app update.

You can Create (or overwrite), Fetch, and Delete.

They also have a development environment, so test it out before going live!

We have 3 tasks:

  • Create JSON that accurately mirrors the CLSContexts in our app
  • Create our JWT for authentication
  • POST to the ClassKit Catalog API

Create the proper JSON

You can examine the specifications for the JSON structure here.

It mostly mirrors our CLSContext, but there’s a couple things to keep in mind. …


There’s an unprecedented demand for digital education right now, and Apple has put millions of iPads into classrooms.

As an iOS developer, you can get your app into this huge platform by creating activities for Schoolwork — Apple’s assignment-management app.

The basic workflow is:

  • The Teacher browses activities and selects one to assign to their students.
  • Students receive the activity, and tap a button to launch them into the corresponding section of your app.
  • Students complete said activity, which gets reported back to the Teacher.
  • The Teacher reviews metrics and marks it as done.

In this article, I’m going to show you how…


Image for post
Image for post
Credit: https://www.pexels.com/photo/pineapple-with-sunglasses-1189314/

Ultimately Apple wants to promote great apps. But they’re also motivated to showcase apps that make their platform look good. They’re competing with Android and trying to sell more iPhones, so if you can help them in their efforts, they’re happy to help you.

This isn’t that crazy of a concept. You see it everywhere. Target is going to promote items that get people in their stores. The movie theater is going to advertise the movie they think will pull in the most people.

Microsoft has done this with games since forever. …


Image for post
Image for post
Source: https://www.pexels.com/photo/white-smoke-52732/

Why were you expecting it to be?

Most likely — you want to know that your user is about to see a screen.

There are all sorts of useful reasons to want that. Maybe you want to track an analytics screen view, or trigger a data fetch to keep your screen fresh. Whatever your aim, someone probably told you to check out viewWillAppear — Well, bad news. It’ll work for those goals, but only sometimes.*

The Simple Answer

The technical reason for when viewWillAppear gets called is simple.

Notifies the view controller that its view is about to be added to a view hierarchy. …


At Livefront, we love unit testing. Part of that is setting up mocks — fake objects you use with dependency injection to make sure the right methods are being called.

Android has the Mockito framework where you can trivially make mocks and dictate return values. We don’t have anything that slick in Swift due to its reflection restrictions. There’s Cuckoo and SwiftyMocky, but I found them a bit onerous. They both generate helpful code (and I’m all for generating code), but way too much. I only want to generate code I’m going to use.

I’m going to show you how to automatically generate a default implementation and mock of a Swift protocol. Computers make us more efficient. Let’s use the computer to make our computer-use more efficient. …


Image for post
Image for post
Credit: www.instagram.com/miss_caitlin_rose (NSFW)

My journey towards creating code looks like this:

  • Research the details of the goal (Learn)
  • Come up with a plan to implement (Create)
  • Code (Clicking and typing)
  • Return to step 1 when I realize I had a false assumption (Regret)

Naming the types correctly is the final obstacle during planning before I can get into the (fun 🤓) labor of coding. It’s like, ugh, I know the computer doesn’t care what I name my type. It’s all going to be stripped away by the time the machine is interpreting the instructions. My functionality won’t be affected. …


The docs for properly uploading data in the background are spread over several documents. Some limitations aren’t enforced by the API. Instead you’ll be notified about the proper usage with a crash. This article will take you on a journey of the many wrong ways to upload in the background before showing you the right way.

Let’s start with the quick and dirty solution you might stumble upon when you first search for how to upload data:

Notice how we used dataTask there? You can certainly use that for uploading data. The key difference Apple describes between dataTask and uploadTask is that dataTask is intended for short requests, and uploadTask allows you to continue execution in the background. …


In my last article, I made the case for why unit tests and code reviews are valuable. In this one, I’m going to show you how to set up an automated system to enforce those principles. Before allowing a PR to be merged, we’re going to require someone to review it and that all unit tests have passed.

Shouldn’t developers be running unit tests before submitting a PR? Yes, but there’s no shame in having guard rails. It’s common for experts to forget a detail or two.


Image for post
Image for post
Typical code review

I’ve been a software developer for a long time (15 years), but only in the past few have I been in a professional collaborative engineering environment. Before that I was a solo developer working on my own projects. When I was solo, I became great at making the computer do what I wanted, but I didn’t have to deal with the complexities (nor gain the benefits) that come from being on a team. In this article I will highlight some of the biggest mindset shifts I’ve experienced and values I’ve come to embrace over the past year.

Code Reviews

After joining a professional team I initially felt dumb, like dang, they keep finding things to call out in my code. I need to not mess up next time. They would hit me with questions I wasn’t prepared for. …


SwiftPoet is a powerful framework built by Gilt Tech to let you generate your own Swift code… using Swift!

Why do this? Sometimes the job of a developer is to crank out some boilerplate code. It’s not all brilliant problem solving. Developers are great at recognizing patterns, and if it’s possible to automate something, we’ll do it.

I’m using SwiftPoet in a command line tool to translate Avro schema definitions into Swift structs that are customized to my liking. (To make your own — check out my article on how to setup a Swift Command Line Tool with a dependency.)

For reference, there is an API doc, but it doesn’t show you how to get started. …

About

Sean Berry

iOS Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store