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
extension View { | |
func shimmer( | |
isActive: Bool = true, | |
speed: Double = 2.5, | |
color: Color =.white, | |
angle: Double = 0, | |
animateOpacity: Bool = false, | |
animateScale: Bool = false) -> some View { | |
Group { | |
if |
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
import SwiftUI | |
struct CodeWindowView: View { | |
@State var visibleLines: [(text: String, lineNumber: Int)] = [] | |
@State private var scrollProxy: ScrollViewProxy? | |
var body: some View { | |
ZStack { | |
// Window chrome | |
VStack(spacing: 0) { |
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
import SwiftUI | |
struct ThinkingIndicatorView: View { | |
@Binding var isExpanded: Bool | |
let streamingText: String | |
let thinkingDuration: TimeInterval | |
@State private var animationOffset: CGFloat = 0 |
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
import SwiftUI | |
struct SlidingToggleStyle: ToggleStyle { | |
var activeColor: Color = .blue.opacity(0.5) | |
func makeBody(configuration: Configuration) -> some View { | |
HStack { | |
configuration.label | |
Spacer() | |
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
// Copyright © 2025 onegai.com. All rights reserved. | |
import SwiftUI | |
struct GenericPickerView<T: CaseIterable & RawRepresentable>: View where T.RawValue == String, T: Hashable { | |
@Binding var selection: T | |
private let labelImageName: String | |
private let localizedString: (T) -> String | |
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 mosaicRectangles(in image: UIImage, from quadrilaterals: [QuadrilateralBox]) -> [QuadrilateralBox: UIImage] { | |
var resultMap: [QuadrilateralBox: UIImage] = [:] | |
guard var ciImage = CIImage(image: image) else { | |
print("Couldn't create CIImage.") | |
return resultMap | |
} | |
// Correct the orientation because `CIImage.init` can lose it |
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
""" To use: install LLM studio (or Ollama), clone OpenVoice, run this script in the OpenVoice directory | |
git clone https://github.com/myshell-ai/OpenVoice | |
cd OpenVoice | |
git clone https://huggingface.co/myshell-ai/OpenVoice | |
cp -r OpenVoice/* . | |
pip install whisper pynput pyaudio | |
""" | |
from openai import OpenAI | |
import time |
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
// | |
// 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 { |
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
import SwiftUI | |
struct RefreshControl: View { | |
var coordinateSpace: CoordinateSpace | |
var onRefresh: ()->Void | |
@State var refresh: Bool = false | |
var body: some View { | |
GeometryReader { geo in | |
if (geo.frame(in: coordinateSpace).midY > 50) { | |
Spacer() |
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
import SwiftUI | |
struct HeaderView: View { | |
var body: some View { | |
HStack { | |
Image(systemName: "info.circle.fill") | |
.resizable() | |
.frame(width: 12, height: 12) | |
Text("Section Header") | |
.font(.system(size: 13)) |
NewerOlder