Skip to content

Instantly share code, notes, and snippets.

@Chronos2500
Chronos2500 / MarqueeLabel-Minimal.swift
Created May 13, 2025 15:19
MarqueeLabel Please be fully aware that these use Private APIs.
let label = UILabel()
label.text = "Swift is a modern, intuitive programming language crafted for all Apple platforms."
label.setValue(true, forKey: "marqueeEnabled")
label.setValue(true, forKey: "marqueeRunning")
label.setValue(0, forKey: "marqueeRepeatCount")
@Chronos2500
Chronos2500 / Example.Swift
Last active March 31, 2025 18:38
UIBlurEffectStyle一覧
// Example
// Custom extension to add a blur effect style with raw value 1100
extension UIBlurEffect.Style {
static var systemChromeBackground: UIBlurEffect.Style {
return UIBlurEffect.Style(rawValue: 1100) ?? .dark
}
}
import SwiftUI
struct ContentView: View {
@State var maxNumber: Int = 50
var body: some View {
Text(verbatim: "Bounce-BasedOnSize")
Slider(value: Binding(
get: { Double(maxNumber) },
set: { maxNumber = Int($0) }
), in: 1...50, step: 1)
import SwiftUI
//自作パッケージの切り出しなので変数名がめちゃくちゃです
//詳しくはこれの実装を見てください https://github.com/Chronos2500/CustomNavigationTitle
struct ContentView: View {
var body: some View {
NavigationStack{
ScrollView {
Color.blue.frame(height: 200)
@Chronos2500
Chronos2500 / ContentView.swift
Created March 6, 2025 12:05
ignoreSafeAreaの動的変更のデモ
import SwiftUI
struct ContentView: View {
@State private var ignoreSafeArea = false
var body: some View {
ZStack {
Color.blue
.ignoresSafeArea(edges: ignoreSafeArea ? .all : [])