Native Software
26 entries
First: Jul 15, 2020
1 contributor
tmm
josephazar
I saw your comment throw my email, but n...
lucas
Had the same experience so far. Seems to...
tmm
I’ll probably use it since it’s a pretty...
lucas
Valuable insights about accessibility. T...
tmm
@lucas can i disable previews? this is g...
internetvin
Really neat!
lucas
Hope I will get to this level soon. lol
lucas
Thanks for sharing. Tried it out in anot...
tmm
good idea - will try it out. also just r...
internetvin
Nice! I want to try this out soon. @luca...
add bookmark

Been off for a bit. Set up Vim to work with Swift. Going to pick up again soon. Moving to a new apartment this weekend which disrupted my flow.

1
add bookmark

Vapor

Bunch of random stuff today

- Learned about downloading and uploading data
- Intro to Vapor
- I really like guard statements in Swift

Also, Setting up Vim to work with Swift/Xcode. I like using Vim because I'm much faster editing text with it, but Xcode is good because it allows you to change certain configuration properties while developing. The problem with Xcode is it is slow to work in (reformatting, navigating around files, etc.).

Did a quick test of editing a file in Vim and Xcode grabs the file's changes when I save. I can use a coc extension to get autocomplete, go-to definition, etc. working. I can also use SwiftLint through Vim to take care of prettying files on save. I've even seen some extensions to build and run on devices from the command line too.

For now, I'll continue with running from Xcode, but will try to edit text mostly from iTerm (Tmux with Vim) after my config is set up. (Hopefully this isn't a huge waste of time lol.)

Note: I've also looked into using XVim, but it seems unstable.

add bookmark

Learned basics about concurrency on iOS: NSThread, Grand Central Dispatch, Operations Queues, and Combine. Started working on a simple app to download songs and album artwork. Need to use URLSessions and GCD for this part of the course. Main takeaway:

DispatchQueue.main.async {
  // Update UI on main thread
}
add bookmark

Starting to play around with SwiftUI more in Playgrounds than inside apps. It's faster to get instant feedback and try concepts out. Today, I was prototyping with timers. Here's a shell for getting SwiftUI and Playgrounds working.

import SwiftUI

struct ContentView: View {
  var body: some View {
    Text("Hello, World")
  }
}

import PlaygroundSupport
PlaygroundPage.current.setLiveView(ContentView())
1
add bookmark

It's frustrating that SwiftUI isn't as far along as I thought. I was trying to do a few things with Lists earlier today and there are a few random bugs. Hopefully they get fixed in the next Xcode Beta.

add bookmark

Took a break from guided learning over the weekend and messed around with SwiftUI in another project. Today, I resumed and learned more about Codable. Specifically, how to assign different names for properties when writing to files, reading data from an API, etc.

struct Task: Identifiable, Codable {
    let id = UUID()
    
    var name: String
    var completed = false
    
    enum CodingKeys: String, CodingKey {
        case id = "identifier"
        case name
        case completed = "is_complete"
    }
}
add bookmark

Finished a section on building user interfaces with SwiftUI. I need to remember to use GeometryReader for getting programmatic access to a view's container frame and layout. This is useful for calculating child size based on a parent, laying out a group of items inside a container, and I imagine much more.

Next, I started learning more about data persistence using FileManager to write and read contents. I briefly started learning more about the Codeable protocol. I remember hearing about Codable a few years ago so excited to start digging in to it.

I've been doing a lot of structured/guided learning lately from online resources and courses. I know enough about SwiftUI to be dangerous so at some point I think I should start building something, and learn as problems come up.

2
add bookmark

Played around with Sign In With Apple and animations.

I’m conflicted as to use SIWA or not because you’re giving away a lot. It is super simple though. Trade offs.

1
add bookmark

Today I first learned more about container views in SwiftUI: Stacks, like HStack, VStack, ZStack, how SwiftUI's layout system works, Lists, Forms, Scroll Views, Navigation, etc. I remember doing all these things in UIKit being much harder and needing a lot more code.

Next, I learned more about binding data to views. Some random notes:

- ObservableObject protocol with @Published property wrapper on properties you want to watch for changes
- @ObservedObject property wrapper
- @Binding property wrapper
- .environmentObject(someReferenceType) used with @EnvironmentObject property wrapper to inject dependencies

Lastly, I got an intro to accessibility with SwiftUI. In the past, I haven't done a very good job of making things I've made accessible. It's always been an afterthought because I'm privileged not to need assistance. SwiftUI and iOS makes it easy so I should be adding and testing accessibility from the start as I get into making my own apps. I added a VoiceOver toggle to the lock button if I triple press it.

Some notes on VoiceOver accessibility:

- Passing a decorative property to Image removes the label from being read by VoiceOver Image(decorative: "ImageName")
- You can hide elements from VoiceOver completely with .accessibility(hidden: true) modifier
- You can provide a more understandable value with .accessibility(value: "Some value")
- Call out specific headers for VoiceOver to recognize .accessibility(addTraits: .isHeader)

There are many other accessibility features besides VoiceOver that I still need to learn more about. In the video I watched, it said Apple has three questions to keep in mind when developing for accessibility:

1. Do displayed strings provide enough information?
2. Would a custom action simplify the interaction?
3. Can you speed up navigation?

After using my phone with VoiceOver for a bit, number three resonated with me the most. It takes a while to navigate around with VoiceOver (Iam very experienced with it). I can see how if an app doesn't provide accessibility support or creates custom elements instead of using Apple's accessible versions, it can be very frustrating to get to where you want to go.

2
add bookmark

Easiest way to add a background color that fills up the whole screen:

ZStack {
    Color(Color.black)
}.edgesIgnoringSafeArea(.all)
add bookmark

Multiple content previews for larger type and dark color scheme:

struct ContentView_Previews : PreviewProvider {
  static var previews: some View {
    
    Group {
        ContentView()
            .environment(\.sizeCategory, .accessibilityExtraExtraLarge)
        ContentView()
            .environment(\.colorScheme, .dark)
    }
  }
}
add bookmark

Woke up late so didn't have as much time this morning. I learned about protocols and extensions. Protocols define requirements and extensions allow for default implementations of those requirements. Here's one useful for accessing ColorSets defined in the asset catalog:

import SwiftUI
extension Color {
    public static let background: Color { Color("Background") }
    public static let brand: Color { Color("Brand") }
    public static let text: Color { Color("Text") }
}

Instead of typing Color("Brand") everywhere (since it's prone to misspelling, etc.), you can do Color(Color.brand).

Also, spent some time playing around with Classes in Swift and inheritance. I already know about polymorphism so this was just practice with syntax.

1
add bookmark

Found this notebook because I ran out of printer paper to scribble on. It has my old Swift notes from 2014-2015 in it! Pretty cool that this loop is continuing again some five years later.

add bookmark

Learned more about programming in Swift:

- Functions: overloading and advanced parameters
- Closures
- Enums: CaseIterable, switch statements, associated values
- Properties and methods: stored, computed, and lazy

add bookmark

I used JavaScript for so long, I forgot how good other languages are. This syntax for swift is really clever:

let numbers = [2, 30, 19, 6, 71, 100]
numbers.reduce(0, +)
1
add bookmark

Designed a few variants of an app icon and added a quick way to switch between them.

add bookmark

Made a tasks app and learned more about SwiftUI views, file organization, binding, different types of navigation views, and models (extensions, protocols, enums, nested types).

I’m still amazed at how fast it is to create decent looking interfaces with SwiftUI. Also, the data binding reminds me a lot of Angular.js and Vue.js.

add bookmark

Started a reference sheet of Xcode bindings so I can move around and do things faster. Unfortunately Xcode doesn’t support Vim easily.

add bookmark

Reviewed Swift fundamentals — optionals, collections, and control flow — today instead of learning SwiftUI.

1
add bookmark

Cool syntax for printing odd numbers from one to ten:

for i in 1...10 where i % 2 != 0 {
    print(i)
}
2
add bookmark

Practiced more with navigation, view state, and styling by building this basic sign in page along with a log out button on the next screen.

add bookmark

Made a super simple iOS app, called Bull’s Eye, in the intro course on Ray Wenderlich. It was pretty boring at times because the course caters towards folks with zero to no coding experience. I listened at 2x speed though so got through fast.

I’m conflicted whether or not to continue with structure, like the course, or just make my own stuff.

Also, learned more about navigation, view modifiers, and alerts that were useful.

add bookmark

SF Symbols - SF Symbols - Human Interface Guidelines - Apple Developer

Finished all 10 videos from Primitive that are released. Learned about a bunch of things:

- Basic Xcode shortcuts (cmd+shift+l to open Library, cmd+option+p to start preview, etc.)
- How to use custom and system fonts
- How to use SF Symbols
- Colors (creating color sets in xcassets is super nice)
- Chaining modifiers
- Layout
- Reusable subviews

SwiftUI has come a long way since I looked at it last year. Subviews are really smooth and just work. You don't have to import them like you do with components in JavaScript. I'm excited by how fast it is to throw together good looking interfaces and put them on a phone.

Until there are more Primitive.school videos out, I'm going to switch over the Ray Wenderlich.

00:00
tmm
tmm Native Software