Skip to content

Instantly share code, notes, and snippets.

View muukii's full-sized avatar
✈️
We live in a twilight world.

Hiroshi Kimura muukii

✈️
We live in a twilight world.
View GitHub Profile
@muukii
muukii / Carousel.swift
Last active September 29, 2025 14:48
Carousel
import SwiftUI
@available(iOS 15, *)
struct Slider: View {
enum SliderPreferenceKey: PreferenceKey {
static var defaultValue: CGRect = .zero
@muukii
muukii / Path.md
Last active February 27, 2023 07:10
iOS 16 SwiftUI interface
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SwiftUI.framework/Modules/SwiftUI.swiftmodule/arm64-apple-ios.swiftinterface
import SwiftUI
import Foundation
extension View {
func snapshot(scale: CGFloat) -> UIImage {
let controller = UIHostingController(rootView: self)
let view = controller.view
let targetSize = controller.view.intrinsicContentSize
view?.bounds = CGRect(origin: .zero, size: targetSize)
let backgroundView = UIView.mock(backgroundColor: .neon(.violet))
let box1 = UIView.mock(backgroundColor: .neon(.red), preferredSize: .largeSquare)
let box2 = UIView.mock(backgroundColor: .neon(.yellow), preferredSize: .largeSquare)
view.addSubview(backgroundView)
view.addSubview(box1)
view.addSubview(box2)
mondrianBatchLayout {
HStackBlock(spacing: 10) {
box2
box1
}
let backgroundView = UIView.mock(backgroundColor: .neon(.violet))
let box1 = UIView.mock(backgroundColor: .neon(.red), preferredSize: .largeSquare)
let box2 = UIView.mock(backgroundColor: .neon(.yellow), preferredSize: .largeSquare)
view.mondrian.buildSubviews {
HStackBlock(spacing: 10) {
box1
box2
}
.padding(10)
let backgroundView = UIView.mock(backgroundColor: .neon(.violet))
let box1 = UIView.mock(backgroundColor: .neon(.red), preferredSize: .largeSquare)
let box2 = UIView.mock(backgroundColor: .neon(.yellow), preferredSize: .largeSquare)
view.addSubview(backgroundView)
view.addSubview(box1)
view.addSubview(box2)
backgroundView.translatesAutoresizingMaskIntoConstraints = false
box1.translatesAutoresizingMaskIntoConstraints = false
/// For Transition
public final class ComposedCornerView: CodeBasedView {
private let topRightMaskView = UIView()
private let topLeftMaskView = UIView()
private let bottomRightMaskView = UIView()
private let bottomLeftMaskView = UIView()
private let topRightView = UIView()
private let topLeftView = UIView()
import ObjectiveC
import UIKit
let swizzle: Void = {
print("swizzle")
method_exchangeImplementations(
class_getInstanceMethod(UIScrollView.self, #selector(setter:UIScrollView.contentInset))!,
class_getInstanceMethod(UIScrollView.self, #selector(UIScrollView._mmm_setContentInset))!