Skip to content

Instantly share code, notes, and snippets.

@JINi0S
JINi0S / Haptics.swift
Created September 5, 2024 18:37
햅틱 써볼래?
import UIKit
///사용 방법
///Haptics.tap()
struct Haptics {
static func tap() {
UIImpactFeedbackGenerator(style: .light).impactOccurred()
}
static func impact() {
@JINi0S
JINi0S / CollectionIsNotEmpty.swift
Created September 5, 2024 18:37
가독성 높여볼래?
extension Collection {
var isNotEmpty: Bool {
isEmpty == false
}
}
@JINi0S
JINi0S / Log
Created September 5, 2024 18:35
// https://www.youtube.com/watch?v=jf9TBhyAXvo 곰튀김님
import UIKit
/*
사용
DEBUG_LOG("View Did Load")
ERROR_LOG("JSON Error")
*/
func DEBUG_LOG(_ msg: Any, file: String = #file, function: String = #function, line: Int = #line) {
@JINi0S
JINi0S / CalculateDataBytes.swift
Created September 5, 2024 18:33
Data 사이즈 파악할 때 사용
// https://gist.github.com/siempay/1dd2af4ccc06cea2858ced27d0988c21
extension Data {
var bytes: Int64 {
.init(self.count)
}
public var kilobytes: Double {
return Double(bytes) / 1_024
}
@JINi0S
JINi0S / FindRegisteredFont.swift
Created March 5, 2024 15:54
내장폰트명 검색 시 사용
Text("Hello, world!")
.onAppear {
for family in UIFont.familyNames {
print("\(family)");
for names in UIFont.fontNames(forFamilyName: family) {
print("== \(names)");
}
}
}