Skip to content

Instantly share code, notes, and snippets.

View brownsoo's full-sized avatar
🐢
Step by step

brownsoo brownsoo

🐢
Step by step
View GitHub Profile
@brownsoo
brownsoo / CompactPreview.swift
Last active December 19, 2025 09:03
UIView 크기만큼 미리보기 제공
/// UIView 크기만큼 미리보기 제공
import SwiftUI
public struct CompactPreview<V: UIView>: View {
@State private var parentSize: CGSize?
@State private var foundSize: CGSize?
/// UIView 빌더
let builder: () -> V
/// 가로를 상위에 채울껀지
@brownsoo
brownsoo / URL+ImageResize.swift
Created April 9, 2026 02:10
CGImageSourceCreateThumbnailAtIndex 활용하는 이미지 크기 변경
import UIKit
import ImageIO
enum ImageResizeError: Error {
case invalidMaxDimension
case cannotCreateImageSource
case cannotReadImageProperties
case cannotCreateThumbnail
case cannotEncodeJPEG