Snippets for my iOS Projects :D
- File Location for:
- User Defaults
| // | |
| // DateField.swift | |
| // | |
| // Created by Szymon Lorenz on 22/2/20. | |
| // Copyright © 2020 Szymon Lorenz. All rights reserved. | |
| // | |
| import SwiftUI | |
| struct DateTextField: UIViewRepresentable { |
Snippets for my iOS Projects :D
| import SwiftUI | |
| #if os(macOS) | |
| typealias OSView = NSView | |
| typealias OSViewRepresentable = NSViewRepresentable | |
| #elseif os(iOS) | |
| typealias OSView = UIView | |
| typealias OSViewRepresentable = UIViewRepresentable | |
| #endif |
| extension CGDirectDisplayID { | |
| func getIOService() -> io_service_t { | |
| var serialPortIterator = io_iterator_t() | |
| var ioServ: io_service_t = 0 | |
| let matching = IOServiceMatching("IODisplayConnect") | |
| let kernResult = IOServiceGetMatchingServices(kIOMasterPortDefault, matching, &serialPortIterator) | |
| if KERN_SUCCESS == kernResult && serialPortIterator != 0 { | |
| ioServ = IOIteratorNext(serialPortIterator) |
| //: A UIKit based Playground for presenting user interface | |
| import UIKit | |
| import PlaygroundSupport | |
| class EdgeInsetLabel: UILabel { | |
| private let textInsets: UIEdgeInsets | |
| init(inset: UIEdgeInsets) { | |
| textInsets = inset |
| import Foundation | |
| @propertyWrapper | |
| struct UserDefault<T> { | |
| let key: String | |
| let defaultValue: T | |
| init(_ key: String, defaultValue: T) { | |
| self.key = key |
| // | |
| // ViewController.swift | |
| // | |
| // Created by Jay Lee on 08/23/2019. | |
| // Copyright © 2019 Jay Lee <jaeho.lee@snu.ac.kr> | |
| // This work is free. You can redistribute it and/or modify it under the | |
| // terms of the Do What The Fuck You Want To Public License, Version 2, | |
| // as published by Sam Hocevar. See http://www.wtfpl.net/ for more details. | |
| // |
| extension String { | |
| func foregroundColor(_ color: UIColor) -> NSAttributedString { | |
| NSAttributedString(string: self, attributes: [.foregroundColor : color]) | |
| } | |
| func background(_ color: UIColor) -> NSAttributedString { | |
| NSAttributedString(string: self, attributes: [.backgroundColor: color]) | |
| } | |
| func underline(_ color: UIColor, style: NSUnderlineStyle = .single) -> NSAttributedString { | |
| NSAttributedString(string: self, attributes: [.underlineColor: color, .underlineStyle: style.rawValue]) | |
| } |
| (lldb) po [[self view] _methodDescription] | |
| <UIView: 0x7fbe93e01bd0>: | |
| in UIView: | |
| Class Methods: | |
| + (id) fallback_debugHierarchyChildGroupingID; (0x101d67dda) | |
| + (id) fallback_debugHierarchyObjectsInGroupWithID:(id)arg1 onObject:(id)arg2 outOptions:(id*)arg3; (0x101d67e72) | |
| + (id) fallback_debugHierarchyAdditionalGroupingIDs; (0x101d67df9) | |
| + (id) fallback_debugHierarchyValueForPropertyWithName:(id)arg1 onObject:(id)arg2 outOptions:(id*)arg3 outError:(id*)arg4; (0x101d69f8f) | |
| + (id) fallback_debugHierarchyPropertyDescriptions; (0x101d6806a) | |
| + (void) _mapkit_animateWithDuration:(double)arg1 animations:(^block)arg2 completion:(^block)arg3; (0x7fff27471b8f) |
| // | |
| // RoundedShadowTableViewCell.swift | |
| // | |
| // Created by Patrick Dura on 08/03/2019. | |
| // Inspired by https://github.com/schluete/GroupedTableViewWithShadows | |
| // | |
| import UIKit | |
| class RoundedShadowTableViewCell: UITableViewCell { |