This guide is adapted from this original post by Christopher Charles.
- Clone the MLX Swift Examples GitHub repository:
import SwiftUI | |
struct ContentView: View { | |
var body: some View { | |
GeometryReader { geometry in | |
let scrollViewFrame = geometry.frame(in: .local) | |
ScrollView { | |
ForEach(0..<1000) { offset in | |
RowContent(offset: offset, scrollViewFrame: scrollViewFrame) | |
} |
// | |
// KeyboardToolbar.swift | |
// | |
// Created by James Sedlacek on 9/20/23. | |
// | |
import SwiftUI | |
import Combine | |
@Observable |
// | |
// EnvironmentBindable.swift | |
// | |
// Created by James Sedlacek on 3/6/24. | |
// | |
import SwiftUI | |
/// A property wrapper that provides a convenient way to bind observable objects from the environment | |
/// to a SwiftUI view. This wrapper simplifies the process of accessing and binding environment objects |
import SwiftUI | |
extension View where Self: Shape { | |
func glow( | |
fill: some ShapeStyle, | |
lineWidth: Double, | |
blurRadius: Double = 8.0, | |
lineCap: CGLineCap = .round | |
) -> some View { | |
self |
This guide is adapted from this original post by Christopher Charles.
// | |
// Persisting.swift | |
// | |
// Created by James Sedlacek on 1/30/25. | |
// | |
import SwiftUI | |
/// A property wrapper that manages the persistence of Codable types using UserDefaults. | |
/// |
// | |
// View+OpenUrl.swift | |
// | |
// Created by James Sedlacek on 11/26/24. | |
// | |
/// This file provides a safe way to open URLs in SwiftUI applications. | |
/// It adds a view modifier that handles URL opening with user confirmation | |
/// and multiple opening options (browser, in-app, or copy to clipboard). | |
/// |
I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).
Use ssh keys and define host aliases in ssh config file (each alias for an account).
#!/bin/bash | |
for file in $(find . -name "*.md" -type f) | |
do | |
echo "file: $file" | |
filenamewithextension=${file##*/} | |
echo "file name with extension: $filenamewithextension" | |
mkdir ${filenamewithextension%.*} | |
echo "file name without extension: ${filenamewithextension%.*}" | |
mv ${filenamewithextension} ${filenamewithextension%.*}/${filenamewithextension} | |
done |