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 | |
extension UITableViewCell { | |
static var reuseIdentifier: String { String(describing: self) } | |
} |
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 | |
extension UIColor { | |
static func dynamicColor(light: UIColor, dark: UIColor) -> UIColor { | |
return UIColor { (traitCollection) -> UIColor in | |
if traitCollection.userInterfaceStyle != .dark { | |
return light | |
} else { | |
return dark | |
} |
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 | |
let disclosureIndicatorImage = UIImage(systemName: "chevron.right")? | |
.applyingSymbolConfiguration(.init(scale: .small))? | |
.applyingSymbolConfiguration(.init(weight: .semibold))? | |
.withTintColor(UIColor.systemGray.withAlphaComponent(0.5), renderingMode: .alwaysOriginal) | |
let disclosureIndicator = UIImageView(image: disclosureIndicatorImage) |
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
const { Canvg, presets } = require('canvg') | |
const { DOMParser } = require('xmldom') | |
const canvas = require('canvas') | |
const fetch = require('node-fetch') | |
const preset = presets.node({ DOMParser, canvas, fetch }) | |
module.exports = async function svgToCanvas(svg) { | |
try { |
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 | |
extension UIStoryboard { | |
static var launchScreen: UIStoryboard? { | |
guard let launchStoryboardName = Bundle.main.object(forInfoDictionaryKey: "UILaunchStoryboardName") as? String else { | |
return nil | |
} | |
return UIStoryboard(name: launchStoryboardName, bundle: .main) | |
} | |
} |
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 | |
class ContainerViewController: UIViewController { | |
convenience init(contentViewController: UIViewController) { | |
self.init() | |
self.contentViewController = contentViewController | |
} | |
var contentViewController: UIViewController? { |
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 SwiftUI | |
func extractViewsFromContent<Content: View> (@ViewBuilder content: () -> Content) -> [Any] { | |
let tupleView = content() | |
let tupleViewMirror = Mirror(reflecting: tupleView) | |
let tuple = tupleViewMirror.children.first!.value | |
let tupleMirror = Mirror(reflecting: tuple) | |
let views = tupleMirror.children.map { $0.value } | |
return views | |
} |
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 SwiftUI | |
struct PageView<Page: View>: UIViewControllerRepresentable { | |
var pages: [Page] | |
@Binding var currentPage: Int | |
func makeUIViewController(context: Context) -> UIPageViewController { | |
let pageViewController = UIPageViewController(transitionStyle: .scroll, navigationOrientation: .horizontal) | |
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 | |
extension KeyedDecodingContainer { | |
func decode(_ type: URL.Type, forKey key: Key) throws -> URL { | |
do { | |
return try URL(from: superDecoder()) | |
} catch (let error) { | |
guard | |
let urlString = try? decode(String.self, forKey: key), |