This file contains 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
// Author: SwiftUI-Lab (swiftui-lab.com) | |
// Description: Advanced SwiftUI Animations - Part 6 Examples | |
// blog article: https://swiftui-lab.com/swiftui-animations-part6 | |
import SwiftUI | |
struct ContentView: View { | |
@State var show: Int? = nil | |
var body: some View { |
This file contains 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
struct CycledAnimationTimelineView<Content: View>: View { | |
var duration: Double | |
var isAnimating: Bool | |
@ViewBuilder var content: (Double) -> Content | |
@State private var isActuallyAnimating = false | |
@State private var startDate: Date? | |
var body: some View { | |
TimelineView(.animation(paused: !isActuallyAnimating)) { context in |
This file contains 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
#!/bin/bash | |
# Assigns a keyboard shortcut to the Export Unmodified Originals | |
# menu command in Photos.app on macOS. | |
# @ = Command | |
# ^ = Control | |
# ~ = Option | |
# $ = Shift | |
shortcut='@~^e' |
This file contains 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
import SwiftUI | |
extension UnitPoint { | |
/// - returns: The point on the perimeter of the unit square that is at angle `angle` relative to the center of the unit square. | |
init(_ angle: Angle) { | |
// Inspired by https://math.stackexchange.com/a/4041510/399217 | |
// Also see https://www.desmos.com/calculator/k13553cbgk | |
let s = sin(angle.radians) | |
let c = cos(angle.radians) |
This file contains 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
@available(iOS 15.0, *) | |
struct TwinkleView:View { | |
private func position(in proxy: GeometryProxy, sparkle:Sparkle) -> CGPoint { | |
let radius = min(proxy.size.width, proxy.size.height) / 2.0 | |
let drawnRadius = (radius - 5) * sparkle.position.x | |
let angle = Double.pi * 2.0 * sparkle.position.y | |
let x = proxy.size.width * 0.5 + drawnRadius * cos(angle) | |
let y = proxy.size.height * 0.5 + drawnRadius * sin(angle) |
This file contains 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
##### 使用说明 ##### | |
# 1. 请填写 proxy-providers - subscribe - url 为订阅链接 | |
# 2. 下载 https://github.com/Loyalsoldier/clash-rules/archive/refs/heads/release.zip 并解压至 ./profiles/ruleset 文件夹下 | |
# 3. 若需要自动更新 ruleset, 请编辑 rule-providers-config - type 为 http | |
##### 参考链接 ##### | |
# 1. clash 样例配置文件 | |
# https://lancellc.gitbook.io/clash/clash-config-file/an-example-configuration-file | |
# 2. clash 规则集 | |
# https://github.com/Loyalsoldier/clash-rules |
This file contains 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
import SwiftUI | |
extension LocalizedStringKey.StringInterpolation { | |
/// String interpolation support for links in Text. | |
/// | |
/// Usage: | |
/// | |
/// let url: URL = … | |
/// Text("\("Link title", url: url)") | |
mutating func appendInterpolation(_ linkTitle: String, link url: URL) { |
This file contains 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
# after the virtual disk has already been expanded (e.g. in proxmox) | |
apk add --no-cache cfdisk e2fsprogs-extra | |
# choose partition then "Resize" > "Write" (to finalize) | |
cfdisk | |
# replace * with partition you are resizing | |
resize2fs /dev/* |
This file contains 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
import SwiftUI | |
// View to split up a string into Text views, split by spaces. | |
struct ContentText: View { | |
private var splitText: [String] | |
let count: Int | |
init(_ text: String) { | |
self.splitText = text.split(separator: " ").map { "\($0) " } | |
if text.hasPrefix(" ") { |
NewerOlder