Skip to content
Meeting minutes and learnings from the physical space meeting.
Branch: master
Clone or download

Latest commit

Latest commit 31bbb94 May 23, 2020


Type Name Latest commit message Commit time
Failed to load latest commit information.

A Flock of Swifts

A Flock of Swifts is a physical space meeting of like-minded people excited about the Swift language. We normally meet each Saturday morning. Here is our meetup page. All people and all skill levels are welcome to join.


We met on Zoom and talked about SwiftUI state observation and looked forward to what is coming at WWDC 2020.

Probing @State and @Binding

We looked the similarities and difference between @Binding and @State. State is the single source of truth that can be connected to two way bindings. We can use the projected type of @State to get at the binding. Everything stays in sync!

Observable Object

We used didSet {} to limit a message to 20 characters. Our combine version didn't work. Here is the broken code for that attempt.

The print show that the string is being truncated but for some reason assign to message isn't working like we think it should.

A minimal custom @Environment example

Exploring the @Environment and @EnvironmentObject

Swift 5.3

Josh walked us through things coming in Swift 5.3

Teaser: Animating 1024

Josh is creating the game 1024. With relatively small code he got the whole game working but without animation. Animation is coming next week.

Divvy Scan

From Joe

This is a short explainer video of the project I worked on during the Brother hackathon:

This will be an open-source project eventually; after releases are finalized.

Stanford Class

Stanford videos are starting to come out. Thanks Matt!

The Composable Architecture

Ray will discuss (and demo) this at next week's meeting.


We met on Zoom and did some review of SwiftUI and Combine

Building up a ViewModel

We built a very simple SwiftUI with a slider and a couple of numbers. We purposefully wrote a lot of wrong code that compiled so we could understand why it was wrong. For example, if you put an onRecieve of a publisher in your view, that publisher is going to get the CurrentValue each time and fail to update correctly. Reviewed the mechanism by which Bindings work with State and ObservedObject property wrappers. How to use the projected type to get bindings for both State and ObservedObjects.

Josh showed off a project to get magic cards and converted it from imperative to declarative and functional reactive. The project is here with two folders, the starting imperative version and the final declarative version:


We met on Zoom and focused on SwiftUI today.

Demonstration of making a view dragable

Use ViewModifiers to make behaviors reusable.

Rolex Watch (1)

Rolex Watch Refactored (2)

Concentration with Animation

Uses a redux inspired approach


We met today on Zoom. There were four presentations.

A demonstration of scale and rotation effect anchor with UnitPoint

by Ray Fix

We created a simple project and explored animation modifiers.

Charting in SwiftUI

by John James

First load in the package using the package manager:

It is very easy to add and remove packages.

Show off the code using this sample code:

John Conway's Life in SwiftUI

Concentration in SwiftUI

by Josh Homann


We met on Zoom.

Talked about Dave Abrahams' apperance on the Swift by Sundell podcast.

Start with a value type, you will discover (not invent) the protocols by exploring the problem domain.

John was running into a problem with creating fancy buttons:

Discovered the problem was that the gradient code using colors from the asset catalog not registered. They can be registered.

Josh: Why can't Xcode auto generate code for the assets?

Presentation on Swift on the Server using Vapor

Ray will be giving a presentation on this on Monday night.

Josh working on a Combine / SwiftUI version of John Conway's Life. Having trouble with timer events.

Next week we will look more at SwiftUI animation and app architecture. If you have DispatchQueue in your View code you are doing it wrong.


We met on Zoom.

Josh presented how to make a type eraser, and when to use type erasure in SwiftUI and Combine:

Ray talked about type erasure with opaque return types using the some keyword.

John presented a flip animationf or his card game and we discussed various ideas for how to animate cards moving from one section of the game board to another.


We met on Zoom.

There have been many small improvements to Swift from Swift 4 to the current 5.2. We are noticing how many of these changes are being utilized in interesting and even unexpected ways in libraries like SwiftUI.

Ray presented a playground on keyPaths

There are many KeyPath types that the compiler uses in various situations:

  • KeyPath<Root, Value>
  • WriteableKeyPath<Root, Value>
  • ReferenceWritableKeyPath<Root, Value>
  • PartialKeyPath<Root>
  • AnyKeyPath

Josh presented a playground on propertyWappers, their wrappedValues and their projectedValues and then demostrated a project to show the projectedValues for the propertyWrappers in SwiftUI and Combine:

John showed his card game in SwiftUI, using image slicing. We discussed some possible solutions for animations.


We met on Zoom due to California's current "Safer at home" restrictions.

Ray presented a measure utility to explore sizing of SwiftUI.Views. Ray discussed new features in Swift 5.2:

Josh presented debouncing expensive operations in combine with an Ascii filter example available here:

Jo fixed her launch image by purging the similator & fixed an opacity animation. Note that that requirement to use a storybaord for your launch screen has been delayed:


We met at Daden LLC where Ray gave a presentation on layout in SwiftUI and how to communicate information up the View tree by using PreferenceKey.

We broke into groups and tried to apply PreferenceKey to the problem of making a grid where you can select a number of squares by dragging.

Josh's solution to this problem is here:

A similar problem solved without preferences by manually calcaluating everything is here:


Josh is working on AWS amplify:

Decoding JSON from firebase dictionaries:

protocol JSONRepresentable {
  init?(json: [String: Any])
  func json() -> [String: Any]?

extension JSONRepresentable where Self: Codable {
  init?(json: [String:Any]) {
    guard let value = (try? json, options: []))
      .flatMap ({ try? JSONDecoder().decode(Self.self, from: $0) }) else {
        return nil
    self = value
  func json() -> [String:Any]? {
    return (try? JSONEncoder().encode(self))
      .flatMap { try? JSONSerialization.jsonObject(with: $0, options: []) } as? [String: Any]


struct User: Codable, JSONRepresentable {
  var name: String

let dictionary: [[String: Any]] = [
  ["name" : "John"],
  ["name" : "Bill"],
  ["invalid": "test"]

let users = dictionary.compactMap(User.init(json:))





Coding challenges for all levels if anyone is interested in trying:

The deadline is fast approaching. Update your apps with a launch storyboard and support for arbitrary screen sizes. As announced at WWDC19, starting April 2020, apps submitted to the App Store must use an Xcode storyboard to provide the app’s launch screen and must have an interface that supports any display size.

CIFilter example:

import PlaygroundSupport
import UIKit

let ciImage = Bundle.main.url(forResource: "dog", withExtension: "jpg")
  .flatMap { try! Data(contentsOf:$0) }

let blur = CIFilter(name: "CIGaussianBlur")
blur?.setValue(ciImage, forKey: kCIInputImageKey)
blur?.setValue(16, forKey: "inputRadius")
let uncroppedImage = (blur?.value(forKey: kCIOutputImageKey) as? CIImage)
let croppedImage = UIGraphicsImageRenderer(size: ciImage!.extent.size).image { _ in
  uncroppedImage.draw(at: .init(
    x: (ciImage!.extent.size.width - uncroppedImage.size.width) / 2,
    y: (ciImage!.extent.size.height - uncroppedImage.size.height) / 2


John working on button customization using a view modifier. I suggested creating a ButtonModifier because you can get at the button.

struct RectangularButtonStyle: ButtonStyle {

  func makeBody(configuration: Configuration) -> some View {
    configuration.label.frame(width: 150, height: 50)

// Use it like this:

Button("Press Me!") {

Josh and Ray working on SwiftUI navigation.

Some background links:

Basic SwiftUI Navigation

Deep Linking (Uses AppState to control navigation) This uses AppState to figure out how views set themselves up.

Combine Tutorial Navigation Combine tutorial which contains some info on "pragmatic navigation" using a view builder function.

Starter Project from Josh

This uses the TVMaze API that creates a simple navigation.

Adding a coordinator turns out to be a little less straightforward than originally thought.

Looking for a Job

Some ideas in no particular order.

  • Hired
  • Vettery
  • TrippleByte
  • Karat
  • Mainz Brady Group
  • StackOverflow
  • Zip Recruiter
  • AngelList

Project a professional appearance online.


  • Simon Simon worked on SwiftUI navigation. We hit a bug where you can't push a view after it has been dismissed. This is really weird.
struct DetailView: View {

    @Environment(\.presentationMode) var presentation

    var body: some View {
        Button("Done") {

struct ContentView: View {
    var body: some View {
        NavigationView {
            NavigationLink(destination: DetailView()) {

Any ideas?

--EDIT: Josh--

John and I worked on the same issue a few weeks ago. The solution is to use a binding for the navigationLink. If you think about it its wierd to be manipulating the global presentation state since whether or not a view is presented is a piece of local state that someone should own (in this case that someone is the parent).

struct DetailView: View {
  @Binding var isShown: Bool
  var body: some View {
    Button("done") {
      self.isShown = false

struct ContentView: View {
  @State private var isDetailShown = false
  var body: some View {
    NavigationView {
      NavigationLink("hello", destination: DetailView(isShown: $isDetailShown), isActive: $isDetailShown)


Ray: Actually this also does not work. If you go back using the back button, you can no longer push onto the navigation stack. (At least in the 13.3 sim). Ray Posted feedback to Apple FB7522002

  • Victoria worked on SpriteKit and attempted to commit her code with Gitup. She understands the importance of version control but isn't a fan of the current product offerings.

  • Other topics included working with Firebase (cascading multiple requests)

2019.12.21 [A Geeky Swiftmas Party]

Making Ornaments, snacks, drinks (moldly drinks!), iPad Pictionary, a presentation, discussion.

Five Swift things to be excited about in 2020.

  • SwiftUI and Combine
  • Swift on the Server
  • Swift for Machine Learning (TensorFlow)
  • The vibrant Swift community
  • Our community

Brainstorm ideas for 2020.

  • Analyze buoy data in relation to tsunamis
  • Build a game for Apple Arcade (or find out what it takes)
  • Build a self driving car (Use Swift for TensorFlow)
  • Build a Draw and Guess Game


2019.12.14 [New Beginnings]

  • Discussion of Markov Chains, Markov Chain Monte Carlo (MCMC)

  • Ray starting aflockofswifts github organization. See me (ray) IRL if you want to join the organization.

  • Josh and John are working on a SwiftUI version of Boggle.

  • John and Josh used UITextChecker to validate the dictionary which contained 250k invalid words. Seems to be slow, it takes 5 minutes to process the 300k dictionary. Cleaned up dictionary opens fast in iOS but crashes in catalyst (???)

  • Xcode 11.3 seems to have trouble opening a large json array. Hangs. (Reported to Apple as FB7493904)

  • Bill wants to know how to use hash tags in his instagram profile (Not Swift related but hey...)

  • Simon is working of SwiftUI layout with video player. Also used Bundle.main to fetch a local video rather than streaming from the web.

  • Victoria is going through a SpriteKit tutorial

  • Book is on pre-order.

Some Code

PrefixTree is a trie that provides fast lookup in the English dictionary for a valid word. Here is the key method:

     func contains(_ collection: SomeCollection) -> Bool {
        collection.reduce(into: self, { $0 = $0?.children[$1]})?.isTerminal == true

Required init issue

A short coming in the current version of Swift is that even if you have a final class if you reference and init a Self you MUST have a required initializer. It seems like it should not be required if the class is final.

Screenshot of Boogle App

Boogle Screen shot

You can’t perform that action at this time.