What on earth is "inout"?

inout may be the most baffling API in the Swift language. At first sight, it seems pretty straightforward.

»
Author's profile picture Yu-Sung Loyi Hsu on swift and inout

The (Not-So) Peculiar Case of Function Retain in Swift

Consider the following Swift code:

»
Author's profile picture Yu-Sung Loyi Hsu on swift, retain-cycle, ios-development, closure, and function

Remotely Accessing a Home Computer behind Double NAT

I used to host websites and web app services at home. However, as I recently moved and the Internet setup at the new house is quite different—my ISP at home uses a giant central router to divide Internet access to each room. That is, a classic Double NAT scenerio. This is not a big deal if you are not trying to access your devices from outside the local network. However, when you need to do that, you will find it impossible because you have no access to the port forwarding features of the central router of the ISP.

»
Author's profile picture Yu-Sung Loyi Hsu on server and remote

A Brief Introduction to SwiftUI

SwiftUI was the UI framework Apple announced during the World Wide Developers Conference (WWDC) 2019. As to support this framework in your app would require the users to update to the latest operating system versions as of the year, iOS 13 and macOS Catalina, it is expected that most of the apps that adopt SwiftUI today are still majorly side projects or smaller apps.

»
Author's profile picture Yu-Sung Loyi Hsu on swiftui, introduction, and framework

Improving on an Algorithm: Time Complexity

Recently, when I was looking at an old solution I wrote months ago for a LeetCode problem, How many numbers are smaller than the current number, I suddenly found that although my previous solution used some tricks in an attempt to do it faster, the function I used made it as slow as the time complexity of a brute force solution.

»
Author's profile picture Yu-Sung Loyi Hsu on algorithm, time-complexity, and big-o