Skip to content

Instantly share code, notes, and snippets.

View rijieli's full-sized avatar
🍺

Roger Lee rijieli

🍺
View GitHub Profile
@rijieli
rijieli / FakeLagetTitleNavigationBar.swift
Created March 16, 2025 09:09
Fake large title navigation bar
import SwiftUI
@available(iOS 18.0, *)
struct FakeNavigationBarView: View {
@State var point: CGPoint = .zero
let titleFullHeight: CGFloat = 100
let titleMinHeight: CGFloat = 44
@rijieli
rijieli / IntelligenceUIPlatterView.swift
Created February 15, 2025 10:01 — forked from stephancasas/IntelligenceUIPlatterView.swift
A SwiftUI expression of Apple Intelligence' NSIntelligenceUIPlatterView — used to accent intelligence-enabled UI components.
//
// IntelligenceUIPlatterView.swift
//
// Created by Stephan Casas on 2/13/25.
//
import SwiftUI
import AppKit
import Combine
#!/bin/zsh
INSTALL_DIR="$HOME/utils"
OLLAMA_BIN="$INSTALL_DIR/ollama"
mkdir -p "$INSTALL_DIR"
get_installed_version() {
if [ -x "$OLLAMA_BIN" ]; then
"$OLLAMA_BIN" -v 2>&1 | grep "client version is" | grep -oE '[0-9.]+$'
@available(iOS 15.0, *)
public struct RichTextEditor : SwiftUICore.View {
public init(text: SwiftUICore.Binding<Foundation.AttributedString>)
@_Concurrency.MainActor @preconcurrency public var body: some SwiftUICore.View {
get
}
@available(iOS 15.0, *)
public typealias Body = @_opaqueReturnTypeOf("$s7SwiftUI14RichTextEditorV4bodyQrvp", 0) __
}
@available(*, unavailable)
#import "UIKitUtils.h"
#import <ObjCRuntimeUtils/RuntimeUtils.h>
#import <objc/runtime.h>
#if TARGET_IPHONE_SIMULATOR
UIKIT_EXTERN float UIAnimationDragCoefficient();
#endif
@rijieli
rijieli / bcp-47-list
Created December 6, 2024 10:01
BCP 47 List From iOS Firmware
<001: world>
<002: Africa>
<005: South America>
<009: Oceania>
<011: Western Africa>
<013: Central America>
<014: Eastern Africa>
<015: Northern Africa>
<017: Middle Africa>
<018: Southern Africa>
@rijieli
rijieli / UIView+LayoutBridge.swift
Created June 7, 2024 04:12
UIView+LayoutBridge.swift
//
// UIView+LayoutBridge.swift
// IdeasForm
//
// Created by Roger on 2022/4/1.
// Copyright © 2022 IdeasForm. All rights reserved.
//
import Foundation
import UIKit
@rijieli
rijieli / HelloAnimation.swift
Created February 24, 2024 09:14 — forked from amosgyamfi/HelloAnimation.swift
HelloAnimation.swift
//
// HelloAnimation.swift
// OpenvisionOS
//
// Created by Amos Gyamfi on 17.2.2024.
//
import SwiftUI
struct HelloAnimation: View {
@rijieli
rijieli / gist:58abc113d032bd48ddd815b65d853582
Last active February 16, 2024 15:55 — forked from bakertim/gist:68a4c5778fb561ea34a4
Set iOS Build Number to Git Commit Count
# source http://blog.jaredsinclair.com/post/97193356620/the-best-of-all-possible-xcode-automated-build
#
# Set the build number to the current git commit count.
# If we're using the Dev scheme, then we'll suffix the build
# number with the current branch name, to make collisions
# far less likely across feature branches.
# Based on: http://w3facility.info/question/how-do-i-force-xcode-to-rebuild-the-info-plist-file-in-my-project-every-time-i-build-the-project/
#
git=`sh /etc/profile; which git`
@rijieli
rijieli / whenHovered.md
Created February 15, 2024 09:19 — forked from importRyan/whenHovered.md
Reliable SwiftUI mouse hover

Reliable mouseEnter/Exit for SwiftUI

Kapture 2021-03-01 at 14 43 39

On Mac, SwiftUI's .onHover closure is not always called on mouse exit, particularly with high cursor velocity. A grid of targets or with finer target shapes will often have multiple targets falsely active after the mouse has moved on.

It is easy to run back to AppKit's safety. Below is a SwiftUI-like modifier for reliable mouse-tracking. You can easily adapt it for other mouse tracking needs.

import SwiftUI