This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
protocol DayPickerViewDataSource { | |
func dayPickerCount(_ dayPicker: DayPickerView) -> Int | |
func dayPickerTitle(_ dayPicker: DayPickerView, indexPath: IndexPath) -> String | |
} | |
final class DayPickerView: UIControl { | |
public var dataSource: DayPickerViewDataSource? { | |
didSet { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
private extension CFStringTokenizer { | |
var hiragana: String { string(to: kCFStringTransformLatinHiragana) } | |
var katakana: String { string(to: kCFStringTransformLatinKatakana) } | |
private func string(to transform: CFString) -> String { | |
var output: String = "" | |
while !CFStringTokenizerAdvanceToNextToken(self).isEmpty { | |
output.append(letter(to: transform)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if canImport(SwiftUI) && DEBUG | |
import SwiftUI | |
struct PreviewViewController: UIViewControllerRepresentable { | |
var viewController: UIViewController | |
init(_ viewController: UIViewController) { | |
self.viewController = viewController | |
} | |
func makeUIViewController(context: Context) -> UIViewController { viewController } | |
func updateUIViewController(_ uiViewController: UIViewController, context: Context) {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Assembled Endpoint for the Network layer | |
/// Usage: Endpoint(host: "https://www.host.com", path: "/path", method: .get) | |
/// .addQuery(key: "queryKey", value: "queryValue") | |
/// .addHeader(name: "headerKey", value: "headerValue") | |
/// .addBody(name: "bodyKey", value: "bodyValue") | |
/// .addBody(name: "bodyKey2", value: ["1","2","3"]) | |
public struct Endpoint { | |
public enum Method: String { | |
case get = "GET" | |
case post = "POST" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Adding Skeleton Animation to a UIView | |
/// Usage: view.showSkeleton(backgroundColor: UIColor.systemGray6, highlightColor: UIColor.systemGray3) | |
/// view.hideSkeleton() | |
extension UIView { | |
public enum SkeletonPosition { | |
case horizontal | |
case vertical | |
case horizontalWithAngle | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension String? { | |
var emptyStringIfEmpty: String { | |
if let self, self.isNotEmpty { return self } | |
return "" | |
} | |
} | |
extension Int? { | |
var zeroIfEmpty: Int { | |
if let self { return self } |