Skip to content

Instantly share code, notes, and snippets.

{
"timeZone": "Asia/Hong_Kong",
"dependencies": {
},
"webapp": {
"access": "ANYONE_ANONYMOUS",
"executeAs": "USER_DEPLOYING"
},
"exceptionLogging": "STACKDRIVER",
"oauthScopes": ["https://www.googleapis.com/auth/script.send_mail", "https://www.googleapis.com/auth/script.external_request", "https://www.googleapis.com/auth/script.scriptapp", "https://www.googleapis.com/auth/spreadsheets", "https://www.googleapis.com/auth/userinfo.email"],
@woodycatliu
woodycatliu / class B: UIView
Created September 21, 2020 03:28
Swift - UIKit :繪製圓角Border
override func draw(_ rect: CGRect) {
borderColor.setStroke()
borderColor.withAlphaComponent(backgroundOpacity).setFill()
let backgroundPath = UIBezierPath(roundedRect: bounds, cornerRadius: borderCornerRadius)
backgroundPath.fill()
let borderPath: UIBezierPath
let borderRect = bounds.insetBy(dx: borderWidth / 2, dy: borderWidth / 2)
if borderCornerSize == 0 {
borderPath = UIBezierPath(roundedRect: borderRect, cornerRadius: borderCornerRadius)
} else {
@woodycatliu
woodycatliu / Back Camera VS. Device Orientation.swift
Last active January 28, 2021 01:47
Swift AVFoundation Orientation
func deviceExifOrientationForBackCamera(_ deviceOrientation: UIDeviceOrientation = UIDevice.current.orientation) -> CGImagePropertyOrientation{
switch deviceOrientation {
case .portrait:
return .right
case .landscapeLeft:
return .up
case .landscapeRight:
return .down
default:
return .right
//
// ViewController.swift
// Created by Woody on 2021/1/28.
/*
a simple example for removing the superimposed ViewController behind
*/
import UIKit

跳轉頁面那件小事

前幾天PM 提出一個需求,需求是A頁面點擊 Button A 會跳轉到 B 頁面, 而 B頁面有一個 Button B 點擊後會重新推出一個新的 A頁面。 所以依照這需求邏輯,當用戶不停的反覆 butoon A -> button B ,ViewController 會無限疊上去。 雖然最後了解這問題是故意設計的,不用處理,但是我還是稍微測試一下。

####測試

方案一、

Firebase-ML Kit

近期收到PM通知,發票 QRCode 有時候會掃不到,同一張發票Android掃得到,但是公司另一個專案的 iOS 版的可以掃 。 這問題可大可小,經過幾次試驗以後,掃不到的那張發票用 Swift metaDataOutput 回傳的都是 nil, 上網查也查不出原因,有看到swift 開發者上有人發問,也不了了之。

為此特地請PM去問出另一個專案用的是 Firebase ML Kit.............

  • 結論
import Foundation
let input = """
3
4
4 2 1 3
2
1 2
7
import Foundation
//let input = """
//4
//2 3 CJ?CC?
//4 2 CJCJ
//1 3 C?J
//2 5 ??J???
//: [Previous](@previous)
import Foundation
let input = """
7
4 6
2 1
7 12
7 2
import Foundation
let input = """
3
4
4 2 1 3
2
1 2
7
7 6 5 4 3 2 1