This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func smallWidgetWidth() -> CGFloat { | |
| switch UIScreen.main.bounds.size { | |
| case CGSize(width: 428, height: 926): // 12 Pro Max | |
| return 170 | |
| case CGSize(width: 414, height: 896): | |
| return 169 | |
| case CGSize(width: 390, height: 844): // 12 | |
| return 158 | |
| case CGSize(width: 375, height: 812): // 12 Mini | |
| return 155 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| override func viewDidLoad() { | |
| switch.setOn(userDefaultsValue, animated: false) | |
| } | |
| @objc func toggleSwitch() { | |
| UserDefaults.standard.set(userDefaultsValue.isOn, forKey: "showMMSS") | |
| UserDefaults.standard.synchronize() | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func setupShadow() { | |
| noCoverStyle.clipsToBounds = false | |
| noCoverStyle.layer.shadowColor = UIColor(named: "secondaryLabel")?.cgColor | |
| noCoverStyle.layer.shadowOpacity = 0.25 | |
| noCoverStyle.layer.shadowOffset = .zero | |
| noCoverStyle.layer.shadowRadius = 6 | |
| noCoverStyle.layer.shadowPath = UIBezierPath(rect: noCoverStyle.bounds).cgPath | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let min = CGFloat(-15) | |
| let max = CGFloat(15) | |
| let xMotion = UIInterpolatingMotionEffect(keyPath: "layer.transform.translation.x", type: .tiltAlongHorizontalAxis) | |
| xMotion.minimumRelativeValue = min | |
| xMotion.maximumRelativeValue = max | |
| let yMotion = UIInterpolatingMotionEffect(keyPath: "layer.transform.translation.y", type: .tiltAlongVerticalAxis) | |
| yMotion.minimumRelativeValue = min | |
| yMotion.maximumRelativeValue = max |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - 打开 Automator | |
| - 新建快速操作 | |
| - 设置自动操作为没有输入,任何应用程序,勾选用输出内容替换所选文本 | |
| - 插入 Shell 脚本 | |
| date "+%Y-%m-%d %H:%M:%S" #定义你自己的时间戳格式,自行参考man date |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- | |
| JS 帮助函数 | |
| 效果:词性彩色高亮。在指定的区块中,若有英语词性符号,则高亮成预定义的彩色背景 | |
| 用法:将下列函数 querySelectorAll('#back')中的 back,换成含有英语词性的区块 ID | |
| 举例:比如正面字段所在区块 & lt;div id="front"> 包含了形如 Test - 'n. 测试 & apos; 这样的英语单词解释,需要高亮词性 n. 那么只要把下列函数中相应地方改为 querySelectorAll('#front')就可以了 | |
| --> | |
| <script type="text/javascript"> | |
| var colorMap = { | |
| 'n.':'#3f3f41', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @State private var showingScore = false | |
| .alert(isPresented: $showingScore) { | |
| Alert(title: Text(scoreTitle), message: Text("Your score is ???"), dismissButton: .default(Text("Continue")) { | |
| self.askQuestion() | |
| }) | |
| } | |
| //to show alert | |
| showingScore = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .random(in: 0...2) |
NewerOlder