I hereby claim:
- I am ethanhuang13 on github.
- I am ethanhuang13 (https://keybase.io/ethanhuang13) on keybase.
- I have a public key ASDAEzUKl1dvIut56bNB61xAdNlHIdUIFYlJ2bJ3k8SlAAo
To claim this, I am signing this object:
// iOS 17's JSONEncoder is rarely producing a different key sorting order(< 5%), which is ok for JSON itself, but will cause flaky tests. | |
// It wasn't happened pre-iOS 17. | |
// https://mastodon.social/@ethanhuang13/110904915670262949 | |
import XCTest | |
final class JSONEncoderTests: XCTestCase { | |
func testEncode() { | |
struct Model: Codable { | |
var a: String = "" |
// | |
// ContentView.swift | |
// ErrorAlert | |
// | |
// Created by Ethan Huang on 2022/6/4. | |
// | |
import SwiftUI | |
enum AError: Error { |
@ViewBuilder | |
private func build<#name#>(_ viewStore: ViewStoreType) -> some View { | |
} |
// A challenge from https://twitter.com/hanyu_chen_ios/status/1395533041989079045 | |
// Screenshots of performance tests https://twitter.com/ethanhuang13/status/1395577548151541760?s=21 | |
import XCTest | |
let maxValue = 100 | |
let minValue = 0 | |
final class ClampTests: XCTestCase { | |
func testMeasureNaiveCompare() throws { |
// | |
// VirtualKeyboard.swift | |
// MacBook Air M1 Zhuyin Keyboard | |
// Written with SwiftUI ~=300 LOC, < 4hrs | |
// Created by Ethan Huang on 2021/1/13. | |
// Twitter: @ethanhuang13 | |
import SwiftUI | |
struct VirtualKeyboard: View { |
// | |
// FacebookAuth.swift | |
// GitHub: ethanhuang13 | |
// Twitter: @ethanhuang13 | |
import AuthenticationServices | |
import SafariServices | |
/* | |
Updated: |
I hereby claim:
To claim this, I am signing this object:
Dear $firstName,
As we announced at WWDC19, we're making changes to further protect user privacy and prevent unauthorized location tracking. Starting with iOS 13, the CNCopyCurrentNetworkInfo API will no longer return valid Wi-Fi SSID and BSSID information. Instead, the information returned by default will be:
SSID: “Wi-Fi” or “WLAN” (“WLAN" will be returned for the China SKU) BSSID: "00:00:00:00:00:00"
If your app is using this API, we encourage you to adopt alternative approaches that don’t require Wi-Fi or network information. Valid SSID and BSSID information from CNCopyCurrentNetworkInfo will still be provided to VPN apps, apps that have used NEHotspotConfiguration to configure the current Wi-Fi network, and apps that have obtained permission to access user location through Location Services.
Test your app on the latest iOS 13 beta to make sure it works properly. If your app requires valid Wi-Fi SSID and BSSID information to function, you can do the following:
let tracker = Tracker() | |
// Which one do you prefer? Consider labels, indendentation, readability... | |
// 1 func trackEvent(_ event: Event, _ parameters: EventParameter...) | |
tracker.trackEvent(.viewItem, | |
.itemId("12345"), | |
.itemName("An Item"), | |
.list("List name")) | |
// 2. func track(event: Event, parameters: EventParameter...) | |
tracker.track(event: .viewItem, parameters: |
// An (useless) example of Swift 4.2 @dynamicMemberLookup attributes. | |
// let color1 = HexColor().cbcbcb | |
// let color2 = HexColor().000000 // This can also be built. Will be treat as "000000" | |
import Foundation | |
@dynamicMemberLookup | |
struct HexColor { | |
subscript(dynamicMember member: String) -> UIColor? { | |
do { |