Image for post
Image for post

There are four ways of distributing your app, but what’s the difference? When I started learning iOS development, the only one I’ve used is the App Store so that I can have my own project downloadable by the public (and the interviewer). Not until I started working in a company that requires internal testing did I get the chance to try out with the other three. Here I’ll tell you what’s the main differences between them.

Ad Hoc Distribution

This one allows you to install all devices that have been registered in your provision profile. You’ll need to:

  1. Register the devices


Image for post
Image for post

Parsing your JSON into Data , and then Decode it to your struct or class model is what we often do in our iOS development life. However, without the aid of unit testing, you’d be either repetitively running your simulator to chase the print log, checking whether you’ve decoded correctly, or opening a blank project/playground, refilling metadata to strike the API. Programmers hate to do repetitive work, and here’s where unit testing comes to the rescue. We can test it locally with a JSON file, fast and dedicated to a specific model.

In this article, I will use the iTunes API to show you how I decode JSON data to models step by step. …


Image for post
Image for post

As an iOS developer, there are times we need to handle no internet conditions. There is a great third-party library, ReachabilitySwift, that helps us do all the underlying work and provide us with easy-to-use APIs.


Class Diagram is a Prerequisite for Learning Design Patterns

A Class diagram is a simplified version of UML(Unified Modeling Language) that helps us get the blueprint of our software project. With the help of a Class diagram, we can easily understand how each component relates to each other, enabling us to modify our software to a more maintainable place. For instance, we’d always want to avoid the dependency chain so that our classes can be changed easily.

Let’s learn the Class diagram directly from one of the most common design patters — Delegate Pattern with a UITableView example.

Image for post
Image for post


Image for post
Image for post

關於 NFC 的功能與限制

搭配使用 Universal link

Universal link 間單說就是開啟 URL,iOS 系統會先去看看該網域有沒有與其相關的 App 存在,如果有,就開 App;沒有的話,就開 Safari。

Universal link 可以在 Safari、App 內網頁(UIWebView, WKWebView, SFSafariViewController)、記事本被觸發。在相機使用 QRCode 或者是系統內建 NFC 也可以透過 Safari 觸發。

範例實作


From time to time, operation team wants to change their content in real-time instead of waiting for new versions of iOS App updated. The two most common ways to fulfill their requirement are Remote Config and WKWebView. Cohering with the title, I’m only going to focus on WKWebView and demonstrate how we implement it.

Showing a web content

Let’s start from the very basic: showing a web content. Not much to explain.😗

Image for post
Image for post

Debugging with WKWebView

We can debug our iOS projects with the aid of Safari. Open Safari and press ⌘+, to open Preference, under the Advanced tab, check “Show Develop menu in menu bar”.


Push notification is taking advantage of the iOS system to gain user engagements with our app. Even though it may seem easy from the users’ perspective, there is a lot for developers under the hood. Here I am going to implement the most common features used in practice.

The demo project can be found here.

Setting up

Note: Pusher is also a great tool but it only supports .p12; PushNotification supports both .p8 and .p12.

  • Push notification does not work on simulators, so you’ll need a real device to perform it. …


Starting with a simple Weather App that listed four cities, I am expecting while I ask Siri to tell me the weather of the city, Siri can directly tell me the weather without opening the app. Furthermore, as I tap on the window in Siri, it shall bring me to the desired city with its weather information. Here I am going to go through the process of adding a custom Siri Shortcut.

Image for post
Image for post

Note: you can clone the starter project from Weather App in master branch. The final project is at SiriShortcut branch. Additionally, build it with screen bigger or equal to 5.5 …


Image for post
Image for post
喬巴,你覆蓋率太低了…

什麼是覆蓋率 (Code Coverage)?就是你寫的測試究竟涵蓋的主程式多少的百分比。看覆蓋率的目的主要是「檢視自己有沒有值得寫而尚未寫的測試。」

我們延續上一篇 Unit Test 教學:非同步測試 API 的 Weather App 來做示範。現在的 commit 是:


Image for post
Image for post

前一篇 Unit Test 教學 是分享測試的核心精神與簡短的驅動測試開發(Test-Driven Development),本篇就是稍稍進階一點的非同步測試。本次就直接以打 API 以及解析 JSON 為例,一步步直接讓你可以應用。範例程式碼在我的 github

測試 API 是死是活

網路測試會切成 web api 死活測試Parsing 測試。web api 死活測試可以把前端後端的職責切得很明確。

Note: 教學文使用純 get url 沒有帶 headers,github 上的範例專案有附 headers。post 可以在掌握概念之後可以自行練習 :)

我傾向把測試的功能分類好,所以就先拉出一個 APITests 吧!

David Wu

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store