Skip to content

Instantly share code, notes, and snippets.

View khcrysalis's full-sized avatar
🍊

khcrysalis

🍊
View GitHub Profile
@khcrysalis
khcrysalis / ContentView.swift
Created July 14, 2025 02:36
Notification Center Blur (macOS) by pai.pie
import SwiftUI
struct ContentView: View {
var body: some View {
ZStack {
RoundedRectangle(cornerRadius: 120)
.fill(.ultraThinMaterial)
.mask(
RoundedRectangle(cornerRadius: 120)
.blur(radius: 40)
@khcrysalis
khcrysalis / programming.md
Created June 30, 2025 21:33
General Rules I Follow When Programming

There's a few rules that I follow when trying to maintain my own personal projects, these rules also expand to any future potential contributor or maintainer that help me along the way. Some rules are more specific when it comes to certain repositories, sometimes they're more lenient, but in general most these rules are just code and project formatting to begin with. If there is any rules that need to be extended due to contributors or maintainers (due to a large project) I will include a CONTRIBUTION.md file that explains more on what you should do when contributing.

Below you will find the languages I have strict rules for when it comes to my personal projects, there could be one or even many. Just know that I will try to enforce these when possible.

Languages

Swift

  • Avoid having any functions or variables at top level, for example avoid having a func example() {} in main.swift
  • Instead, you can make a static variable or function associated to an extension/class/enum to make them access
@khcrysalis
khcrysalis / OnboardingView.swift
Last active July 14, 2025 02:37
Fancy Onboarding SwiftUI View for iOS
import SwiftUI
// MARK: - View
struct OnboardingView: View {
@AppStorage("Feather.onboarding") private var _onboardingFinished: Bool = false
@State private var _page: Int = 0
private var _pageLimit: Int = 2
// MARK: Body
var body: some View {
@khcrysalis
khcrysalis / onboarding.swift
Last active July 14, 2025 02:37
Apple-style Onboarding Window Setup for macOS
func showOnboarding() {
let window = NSWindow(
contentRect: NSRect(x: 0, y: 0, width: 640, height: 600),
styleMask: [.fullSizeContentView, .nonactivatingPanel],
backing: .buffered,
defer: false
)
// Replace your own view here
let onboardingWindow = NSHostingView(rootView: EmptyView())
@khcrysalis
khcrysalis / SettingsLinkWrapper.swift
Created January 8, 2025 03:37
Wrapper for various ways to access settings in SwiftUI.
{
"name": "example",
"author": "ur_mom#42069",
"theme_color_map": {
"KEYBOARD": ["#000000", "#FFFFFF"],
"BACKGROUND_PRIMARY": ["#000000", "#FFFFFF"],
"BACKGROUND_SECONDARY": ["#000000", "#FFFFFF"],
"BACKGROUND_SECONDARY_ALT": ["#000000", "#FFFFFF"],
"BACKGROUND_TERTIARY": ["#000000", "#FFFFFF"],
"BACKGROUND_ACCENT": ["#000000", "#FFFFFF"],
{
"name": "Toothpaste",
"description": "For someone special.",
"version": "0.2",
"authors": [
{
"name": "flower!",
"id": "836452332387565589"
}
],