blog.iankulin.com

blog.iankulin.com

Wordpress Code Blocks

I compare ways of displaying Swift code snippets in WordPress posts, including the default code block, the paid SyntaxHighlighter block, screenshots, pasted rich text, and raw HTML, aiming for Xcode-style syntax highlighting. Citing Paul Hudson’s site as the ideal, I conclude that a proper solution would require better HTML and CSS skills than I currently have...

Changing Xcode Font Size

Here’s a short tip on changing the code font size in Xcode: rather than adjusting each content type manually through the themes preferences, I use Ctrl + Plus and Ctrl + Minus to increase and decrease the font size directly...

Project 5 - Word Scramble

I built a Scrabble-like word game as a 100 Days of SwiftUI project. I cover bundling a large text file and loading it into an array at view launch, plus a brief detour into UIKit to use UITextChecker. My source code is on GitHub...

Word Scramble Feedback

After finishing the Word Scramble challenges in Hacking with Swift’s 100 Days of SwiftUI, I review Paul Hudson’s subscriber-only solution and pick up two improvements. The first is a clearer way of resetting the used-words array; the second replaces my bottom-toolbar score display with a safeAreaInset that initially seemed overcomplicated but looked better in practice...

How to upgrade XCode and Swift

A short note on updating to Xcode 14 and Swift 5.7: the update is found in the Mac App Store rather than Xcode’s About dialog. I also show how to check your current Xcode and Swift versions, both through Xcode’s project settings and via the command line, and link elsewhere for details on what’s new in each release...

How to download a file from GitHub

I share a quick tip for downloading an individual file from GitHub without cloning the repository: use the Raw button to get a direct link to the file, then save it via the browser as you would any other web resource...

Project 4 Challenges

I complete the Project 4 challenges of the 100 Days of SwiftUI course and compare my solutions to Paul Hudson’s video solutions. Differences covered include Section header syntax, a picker implementation containing a careless bug, and moving a bedtime calculation into a computed property. Finding the comparison useful, I plan to check the video solutions going forward...

Machine Learning

Reflecting on how a Tom-Tom GPS once seemed to predict my destinations, I work through Day 27 of 100 Days of SwiftUI, which covers CoreML by training a model in CreateML from Xcode and using it in an app. I note how straightforward the process was and that I’m more excited about small uses of machine learning, like better defaults for user inputs, than ambitious applications. I link to Apple’s machine learning introduction...

Before SwiftUI

Working through Day 26 of 100 Days of Swift, I watch an iOS Academy video on dates, calendars, and date components. My main observation is how long UIKit and storyboard setup takes before any useful code gets written, prompting my appreciation for SwiftUI and Swift Playgrounds as learning tools...

Rock, Paper Scissors (2)

A follow-up to my SwiftUI rock-paper-scissors app built under deadline, working through the improvements noted at delivery. I replace array-and-int game logic with a Swift enum, consolidate separate win/loss checks into a single gameResult function returning a win/loss/draw type, and swap duplicated .hidden() views for an .opacity modifier with a ternary, cutting the view body from 74 lines to 52...

Swift enums

In refactoring my rock-paper-scissors project, I replace Int-based hand shape values with a Swift String enum, eliminating the risk of array out-of-bounds errors and allowing switch statements without a default case. I include notes on Swift enums compared to C, enum methods, and my uncertainty about naming the type Shape versus FingerShape...

.git stuffed

A git workflow run-in with the “unrelated histories” error: after pushing my local work to a GitHub repo initialized with a readme, I couldn’t merge the two histories despite pulling and pushing attempts. I ultimately deleted the .git folder and the remote repo and started over, with plans to reproduce the problem later...

Rock, Paper, Scissors (1)

A working SwiftUI version of the Hacking with SwiftUI Day 25 project, a Rock, Paper, Scissors game where the player must randomly try to win or lose each round. I share the full source code and list aspects of the implementation I’m unhappy with, such as the array-and-int game state, duplicated win-checking functions, and a hidden-view layout workaround, and note the scoring deviates from the project brief...

A deadline is a good thing

I keep a few pre-written blog posts in reserve to maintain a daily publishing schedule and streak, but one tired evening the buffer ran dry. The resulting deadline pressure pushed me to finish a minimum viable version of a half-started project...

Learn to Code

A short introductory post explaining why my blog exists: I want to publicly track my progress through Paul Hudson’s 100 Days of SwiftUI, and I believe that writing about a topic forces a clearer understanding of it, an approach known as the Feynman Technique. A Fireship video on the topic is embedded...

.self in ForEach

While working through Hacking With SwiftUI, I run into two points of confusion around ForEach: what the id: .self key path actually does when looping over an array of strings, and a compiler warning about non-constant ranges such as 0..<agents.count. Attempts to use key paths directly don’t compile, and a forum explanation of the warning — guarding against the array changing size during the loop — leaves me unconvinced...

I git it*

A short reflection, prompted by a trending ProgrammerHumor meme, on my now-routine git and GitHub workflow. I cover the Pro Git book as my main source of understanding, my preference for the git CLI in a customized zsh terminal over tools like Xcode, and my open questions about consolidating many small learning repos into a single repository...

Project 3

My solutions to three small SwiftUI challenges: using a ternary with semantic colors to turn the total red at a 0% tip in WeSplit, wrapping the flag Image in a reusable FlagView for GuessTheFlag, and building a custom ViewModifier with a View extension that applies a large blue title style. Each solution includes a short code snippet and a link to my change on GitHub...

Sean != Erica

With few current podcasts focused on learning Swift, I have been working through older episodes of shows like Fireside Swift and Swift Over Coffee, enjoying hearing past predictions such as Paul Hudson’s doubts about an iPad-capable Xcode. I compare the two seasons of Swift Over Coffee, finding co-host Sean Allen’s beginner questions more useful than the more expert pairing with Erica Sadun, despite her deep Swift knowledge...

Day 23 - Views and Modifiers - Part 4

A SwiftUI tip on decomposing views by extracting them into custom View structs that accept values at initialization, illustrated with a reusable padded green text component. I favor this approach because such building blocks are portable and can be used in other views...