Hawaii iOS Developer Meetup – Session 49

During this meetup we discussed ways to create a pomodoro timer that switches itself from working to resting. I ran this meetup a little differently from usual. I showed the finished product. Then the developers mob-programmed for 45 minutes and replicated it.

The run time on this recording is a full 30 minutes longer than any we’ve recorded in the past. I let this one roll while we finished up and tested the app.

Next week

Next week I’m doing a talk on creating a pomodoro timer for watchOS. Here’s a link to the completed code: https://github.com/Hawaii-iOS-Developer-Meetup/pomodoroWatch001

Please RSVP if you’re interested in attending

Hawaii iOS Developer Meetup – Session 26

Fantastic meetup this week. We covered Firebase Analytics and a host of questions came up. There were questions about Admob integration, the true costs of Google Services, and if Apple keeps a percentage of your advertising revenues.

All the questions that came up are addressed in the meetup video.

For the past 2 meetups the conversation after the presentation has taken longer than the time we have. As a result we have not be able to mob program. I’m eager to get this going again.

Next week we’ll be doubling down on Firebase integration by focusing on User Logins and Admob integration. Please RSVP if you’re interested in attending.

Hawaii iOS Developer Meetup – Session 21

I managed to get the streaming computer to work correctly this week. We had a few technical difficulties. I find that narrating my way through them tends to put everyone at ease through the process.

Last time we met we discussed closures and I had loaded too much content into the talk. This time we covered Results, Errors, and Optionals. I am glad that I prepared just a light talk on the material. We ended up discussing guard let and if let for a good 20 minutes.

I shared with Joanne that I had read something about group sessions and how it’s wise to leave room at the beginning of the meetup to review anything that was unclear from the last meetup.

This time through I asked at the beginning of the meetup, after the introductions, if anyone had questions about the last meetup on closures. Joanne brought up the fact that the mapping functions Chae wrote at the last meetup was unclear. So we took about 15 minutes to discuss that section.

Going forward I am planning to loop back around at the beginning of the meetup to leave room for discussions of questions that lingered from the previous meetup.

I’m glad to have discovered this method of looping back around, seeing how effective it is in promoting continuity in the meetup, and to make sure that the time we have set aside for meeting is rife with learning opportunities, psychological safety, and powerful swift programming.

If you’re interested in attending the next meetup, we’re covering Classes vs. structs vs. enums. Please RSVP if you’re interested in attending!

Hawaii iOS Developer Meetup – Session 20

No stream to share this time. The camera was set to record with OBS but the computer thought it was still connected to 2 monitors. I was not able to aggregate all running programs on one monitor and restarting did not help. So I decided to proceed with the meetup without streaming or recording. And it went well. I believe everyone learned something new.

I felt like I was trying to cram too much space into a single talk and ended up lecturing at the attending developers more than teaching and letting them ask questions.

Good notes for future meetups.

We did have a chance to go over the exercise I created for the meetup. I created a function that doubled, removed odds and summed the total.

The Mob Programming challenge was meant to have them get into the hot seat and code. Getting over that fear of doing something in public is central to my ideas in terms of learning how to code. And doing it well.

I shared a story that reminds me to just throw my hat into the ring, especially if I’m afraid.

When I was about 16 years old, I had been playing the guitar for about 4 years. My friend Johnny told me about a jam circle in Aiea that I just had to go to with him. He didn’t really share the logistics or how the group worked and I didn’t ask. I packed up my Fender Strat and took my tiny amp and Johnny picked me up in the morning.

We drove to Ewa. Took us about 20 minutes. We parked in a strip mall. And walked our gear up stairs. The drive took longer than expected and we were about 15 minutes late.

Johnny opened the door and I followed him in. There must have been about 30 old-timers sitting around jamming together. I was intimidated but tried not to let it show.

I sat down and watched Johnny take out his guitar, tune it, and set up. I was frozen.

The other men acted like they had seen Johnny before too. I don’t think he had ever been here before.

I sat there, still frozen.

One guy started the riff, easy 1-3-5. Then each person in the circle would take his turn (about 2 minutes) riffing leads over the chord progression.

Johnny did a good job riffing.

When it came to me, I said that I wasn’t going to participate. So I sat there and listened for 40 minutes. Just sitting there and feeling like shit.

Nearly 20 years later, I still remember that day. I remember it because I regret it. I should have gotten my guitar out, plugged in, and ego-be-damned, played my little heart out.

I shared this story with the meetup attendees as a caution to get out of your comfort zone. And a reminder that we are all beginners. And that you just need to get started to get going.

I’m looking forward to tonight’s session on Result Errors vs. Optionals!

If you’re interested in attending the meetup, please RSVP.

Swift Pair Programming – Session 8

I’ve been sick for a few days. Didn’t want to cancel pair programming with Nick. We met online at 6pm. I got access to a repo we were working on last time with GPS. Very glad we paired. Finally getting comfortable with Swift. Started in on the agenda and didn’t stop until 7:20pm.

I had a list of topics I wanted to cover last night:

  • Conditionals
  • Coalescing Operators
  • Optional Chaining
  • Guard
  • Defer
  • Unwrapping (forced vs implicit)
  • Typealias

Surprisingly, we were able to cover all of the topics last night. I’m excited because next time we’ll be dipping into xctests.

Here are my notes from the session:

Conditionals are either some() or none(). If they are none that means they are allowed to be nil. If they have a value they will return some() with the value inside of it.

Coalescing Operators allow us to set an enumeration with a default value. If no value is set for it, we will give it this default value

Optional Chaining allows you to code nested ifs. If the first item fails, none of the following nested calls will ever be called. Allows for elegant failing.

Guards are for hacky code. If fails, we will know it and react accordingly.

Defer executes code in a block whether the containing function’s block succeeds or not. I like to think of defer as a function’s deconstructor – use it as clean up.

Code in a defer is guaranteed to execute whether the following code in the method executes or not. We also verified that the defer block has access to variables in the containing method block’s scope.

Unwrapping signals to the compiler, “I know, compiler, this will have a value when this statement is called. It may not look like it now, but I guarantee it will have a value when it needs it.”

Forced Unwrapping differs from Implicit Unwrapping.

Forced unwrapping means that you create a conditional with a question mark. This means that you are telling the compiler that “this value might be nil. Don’t freak out, I know this can be nil.” Then when you use the conditional parameter, you MUST force unwrap it in the method block.

Implicit unwrapping simply saves you from having to force unwrap a conditional every time you use it in the method block. By writing a bang character in the parameter list in the function signature, you are telling the compiler, “I know this might look like it’s nil now, but I promise I will have something in it.” Implicitly unwrapping a parameter, saves time from having to force unwrap a conditional every time it comes up later in the statement block

Typealias is used to make your code more readable. That’s it. Let’s say you create a tuple that holds an int and a String. Let’s say you’re using this to hold a customer id and a string.

Now let’s say you have a tuple that saves an Int and a String to hold a business with a business id and a string. If you just had the datatypes (Int, String) and (Int, String) how would you tell them apart?

This is where a typealias comes in handy. By typing the tuple, you can refer to them with a name rather than have to determine each time you see a tuple with (Int, String).

For customers we could write:

typealias customer = (Int, String)

For employers we could write:

typealias employer = (Int, String)

Questions that came up during the pairing session:

  • Should we use a guard statement, a conditional, an implicitly unwrapped variable, or if let when dealing with potential nils?
    if let n = function_001(), let m = function_002() 
      // do something
      // return error code
      Assignment that may or may not succeed.
      Only expects argument

Shared Xcode Tips and Tricks:

  • Set Finder to always show scroll bars – System Preferences -> Finder -> Always show scroll bars
  • Use GPX files to spoof Pokemon Go game – Allows you to play out a GPX file, including location and speed, catch pokemon without walking to them.
  • Fold all code to reduce cognitive load while coding: Shift + Alt + Command + Left Arrow
  • Unfold all code – Shift + Alt + Command + Right Arrow
  • Enable Focus Follows Selection to know where your cursor is at all times – Editor -> Code Folding -> Focus Follows Selection
  • Update the comments in Xcode to show at a smaller font size – About -> Preferences -> Font -> Click on comments -> reduce font size

Questions for next time:

  • Are there any online Swift playgrounds?
  • Is ScreenHero invites open to anyone?
  • Should we start streaming these pair programming sessions on twitch?
  • Mind if I start screenrecording these sessions?
  • What’s the difference between a argument and a parameter?
  • Is there an Xcode plugin that allows finger pinching to scale the font size of the code?

Thoughts to meditate on:

  • Closures are like expressions. Think of it like a parameter, or a return, or a type.
  • Able to capture scope (I don’t understand this)
  • Start xctests next time

Swift Pair Programming – Session 7


Fantastic pair programming session with Nick last night. In the span of 1 hour we solved a datatype casting issue and set up CoreLocation on a new project.

Last week we were stumped authenticating with Twitter through an p2/OAuth. The code was built to OAuth into github. I had an hour after work so I looked for another OAuth library and found OAuthSwift.

Unfortunately it doesn’t build. I tried it both ways. Once with a Podfile to install. And another time dragging in the xcodeproject file and adding the framework to the target’s Build Phase. No Dice.

Building the app fails with 366 errors. “That’s cool,” I thought. I’ll just update the code to Swift 3 syntax. Minutes later, do another build.

Great. Only 306 errors.

I switched it up and switched targets to the demo build within the OAuthSwift project. Hit build, still errors errors errors.

I wasn’t satisfied with the outcome. What am I doing wrong? 

I got the idea to test building against a trivial open source app on github written in swift. Enter FlappySwift, a nice little flappy bird clone. NOTE TO SELF: Use this framework to build Mathogen in Swift with SKSprites.

FlappySwift built with no errors!

The issue was not with my Xcode installation or configuration. It’s in the OAuthSwift library. I was in the middle of submitting an issue to the maintainers of OAuthSwift when Nick called me on ScreenHero to start our pairing session.

We visited for a bit and talked about how we each spent our respective Thanksgivings. I shared that I had been working on OAuthSwift for the past hour. And we decided to shift our focus of the night to other things.

OAuthSwift, you’re still in my sights. I will get you to work!

We decided to make a list of the things we wanted to pursue next. Nick had an issue with an NSObject passed in a local notification. This weekend I added push notifications to my app and learned that my app needs to have a https connection in order to receive push notifications. I did a hacky workaround that allowed for http but felt weird about it.

I suggested working on creating SSL certificates with LetsEncrypt, but it seems kind of server based. The pairing session is for iOS pairing!

We decided to focus on Nick’s Notification code. Here’s the finished code:

//: Playground - noun: a place where people can play

import UIKit
import CoreLocation

var str = "Hello, playground"

//enum NotificationTitle {
//    static  NotificationToPostName
typealias payloadDict = [String: AnyObject]

class ReceivingClass: NSObject {

func registerForNotification() {

NotificationCenter.default.addObserver(forName: NSNotification.Name(rawValue: "TheNotification") , object: nil, queue: nil, using: { notification in
let tuple: (CLLocation, String) = notification.object as! (CLLocation, String)

class BroadcastClass: NSObject {

func postNotification()  {

let myTuple: (CLLocation, String) = (CLLocation.init(latitude: 12.1, longitude: 12.2), "The String")

let notification = Notification.init(name: Notification.Name(rawValue: "TheNotification"), object: myTuple , userInfo:nil )

let receivingClass = ReceivingClass()
let broadcastClass = BroadcastClass()


Here’s the exact place in the code we were able to sort it out:

let tuple: (CLLocation, String) = notification.object as! (CLLocation, String)

Can you see where the object in the tuple needed to be casted before it was printed? The tuple holds a string but the compiler doesn’t know that. It needs to know that this data is a string or else it’s like, WTF man?

Having made quick progress squashing that bug, Nick asked me what I wanted to focus on.

I said I was interested in GPS. I haven’t worked on any projects that have used GPS yet. We dove in and created a quick project. After the session Nick posted it to github. You can check it out here: Stalker.

Programmers come up with silly names for their projects to keep ourselves from throwing the computer out the window 🙂

Over the course of the rest of the pairing session I learned the following:

  • In order to add GPS functionality you need to add keys and values to the plist
  • Set the values with strings that will come up in the alert.
  • Call Background Execution to keep the app polling for updated locationDo the location requests in the View Controller

Before the next meeting I am going to do the following:

  • Check out the swift style guide.
  • Read the rest of the fuckingswiftsyntax
  • Check out crashlytics for showing
  • Can add a bash script to run on start up.
  • Add a new buildphase and run the script there.
  • Create PCH file: pre-compiled header file in objective C to hold OAuth tokens and keys.
  • Use typealias to set the kind of datatype you want to use. EG: typealias payloadDict = [String :AnyObject]
  • Write all code in Swift 3.

And here are some unsorted extras:

  • Command + 1 to zoom in on the simulator.
  • Asked Nick how he learns. Videos? Nope, gets into a blog post or a how to and just dips in and dips out. We agreed that we both get stuck and a little fatigued learning the entire codebase at once. Good to dip in and out of documentation.

Looking forward to the next pair programming session! In other news, the first Hawaii iOS Developer Meetup is tonight at the Manoa Innovation Center at 5pm. See you there!

Swift Pair Programming – Session 6


Last week Nick and I took another run at OAuth2 in Swift. Hawaii isn’t affected (neither fall nor spring) by Daylight Savings Time. I called him an hour early while he was still driving back from work. Once we determined why the scheduling was incorrect, we reconvened and dove back into OAuth with Swift.

Unfortunately we weren’t able to get the application to authenticate. After the first run through, I looked deeper into the actual OAuth process. I have a better understanding of the delineation between Consumer Keys and Consumer Secrets versus the Access Keys and Access Secrets.

I suspect that we are unable to connect because we are using an open source library to connect to Twitter that was actually written to use OAuth to connect to github. The list of attributes necessary for the connection are different from the way we are meant to connect with Twitter.

As our pairing time was winding down, we did two things. We searched for another open source OAuth repo to test with. We also talked about how we both don’t really understand lambdas.

“Wait, have you heard of this fucking website for Swift closures?” Nick asked.

Thinking I hadn’t heard him correctly, I said, “No.”

He was already sharing his screen and opened up Safari. He started typing in the url, “fuckingswiftblocksyntax.com” and I couldn’t help  laughing. Once we finished typing the url I couldn’t hold it in. And laughed for an uncomfortably long time 🙂

To put this in context a few weeks back he shared a JSON parser called Freddy. Their tagline is:

“So, Freddy vs. JSON, who wins? We think it is Freddy.”

You have to add some levity to this profession that sometimes feels like crafting concrete skyscrapers with steam. That’s the thing about the profession. There’s nothing tangible. We’re working with electricity. Making it to magical things. And it could break at any time.

Nick also mentioned a testing framework that was developed to allow debugging inside the simulator but I can’t remember it now. I made a note to myself to ask him tomorrow.

This weekend I successful set up push notification in my app. Hemingway was famous for saying that when he was writing he would always stop at a place where he felt he could easily get back into the groove the next day.

As I get more and more experience developing I find myself forcing myself to stop as soon as I have made some serious project after a full day of working. Knowing when to stop to avoid burn out is a hard lesson to learn, an even harder rule to follow, but a worthwhile lesson in humility, patience, and love of the craft.

Swift Pair Programming – Session 5

screenshot-from-2016-11-10-100142Yesterday, Nick and I pair programmed Swift in Screenhero. We’ve been doing sorting algorithms over the past few weeks. This time we discussed changing up the game plan.

During our previous pairing sessions we created a playground in a swift ios project. Apparently, creating a playground in a project prevents you from getting real-time compilation and console output.

Another reason for working with Swift in a project, rather that just a playground, is that we’ll be able to utilize some of the libraries and frameworks that are available in a full project. To be honest, I’m not sure how to import a library or framework into a Swift playground.

Therefore, after listing these concerns with Nick, we decided to pair program within the confines of a project. In the past, Nick mentioned wanting to do some image manipulation. I’m most interested in setting up a single point of authentication with OAuth.

Combining these two desires together, we decided to code up an Instagram clone for our pairing sessions.

Last night we found p2/OAuth2, an open source OAuth project on github, that is written in Swift (our pairing language). I was about to clone the repo and import the contents into our project when Nick showed me some awesome new technology called CocoaPods.

Before I talk about CocoaPods, let me explain about package managers. Package managers are like magically updating software managers that pull the latest updates from an internet connected manager and bring all the files, dependencies, and configurations into computer automagically. All the computer scientists just cringed a little from my explanation. That’s fine. It works for me.

Usually these package managers, like homebrew, npm, and apt are used to update the packages on your computer. With CocoaPods the community has brought together a package manager for iOS applications!

We created a pod to download p2/Oauth2 and spent the rest of the pairing session configuring the pod and attempting to connect to Twitter’s API to get a list of Nick’s Twitter followers.

We didn’t manage to get the authentication working last night. Next week we’ll get the application to authenticate. Then I’d like to work on integrating Facebook. Then IG, if that’s possible.

This week, to prepare for our next programming session, I’ll be testing out the p2/OAuth2 code from my personal machine at home. And I’ll also be doing Ray’s tutorial on OAuth2 in Swift. Nothing like being prepared, setting an agenda, and checking off items on a list 🙂

Swift Pair Programming – Session 4

Today Nick and I worked on the insertion sort in swift. The biggest problem we ran into was learning how to iterate through an array in swift backward. We ended up using “stride” to define the start, end, and increment amount.

Here’s the code for stride:

for index in stride(from: 5, to: 1, by: -1) {

There is also a way to do this in swift using the reverse function:

// Print 10 through 1
for i in reverse(1...10) {

Next week we’ll be tackling the merge sort.

Swift Pair Programming – Session 1

Just finished pair programming with Nick. He’s in San Francisco. And I’m in Hawaii. We’re using ScreenHero to pair and it’s fantastic. There was a bit of a lag in screensharing because my internet connection was pretty bad. Next time I’ll be pairing from the library or from Hi Capacity. An hour goes by really quickly. Maybe we need to meet for longer?

Prior to meeting I made a list of the topics that I understand the least:

  • Closures
  • Coalescing operators
  • Optional binding
  • Force unwrapping
  • Guard statements
  • Optional chaining
  • veratic parameters
  • inout parameters
  • Nested function that returns a function
  • Currying

Questions that came up this session

How to we indicate a multi type array?

Lessons learned

  • Playground will not show up the play button if its a playground inside of the xcode project.
  • edit all in scope.
  • can’t do ++ in swift
  • Figure out how to do a next item in swift that is safe
  • Use inout in your parameter list to mutate parameter. Be sure to call method with & on parameter to indicate inout status

Shared tools:

SpectacleApp – FREE mac app to move and resize windows with ease. Window control with simple and customizable keyboard shortcuts. For mac.

Next Week:

We’re planning on finishing the bubble sort.