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
| // Very slightly adapted from http://stackoverflow.com/a/30141700/106244 | |
| // 99.99% Credit to Martin R! | |
| // Mapping from XML/HTML character entity reference to character | |
| // From http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references | |
| private let characterEntities : [String: Character] = [ | |
| // XML predefined entities: | |
| """ : "\"", | |
| "&" : "&", |
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
| static const int target_key; | |
| @implementation UIGestureRecognizer (Block) | |
| +(instancetype)nvm_gestureRecognizerWithActionBlock:(NVMGestureBlock)block { | |
| return [[self alloc]initWithActionBlock:block]; | |
| } | |
| - (instancetype)initWithActionBlock:(NVMGestureBlock)block { | |
| self = [self init]; | |
| [self addActionBlock:block]; |
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 | |
| import AVFoundation | |
| import ReplayKit | |
| class RPScreenWriter { | |
| // Write video | |
| var videoOutputURL: URL | |
| var videoWriter: AVAssetWriter? | |
| var videoInput: AVAssetWriterInput? | |
| // Write audio |
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
| // | |
| // FetchedResultsControllerPublisher.swift | |
| // ListsModel | |
| // | |
| // Created by Joseph Lord on 09/06/2019. | |
| // Copyright © 2019 Joseph Lord. All rights reserved. | |
| // | |
| import Foundation | |
| import Combine |
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
| func scaleTransform(for view: UIView, scaledBy scale: CGPoint, aroundAnchorPoint relativeAnchorPoint: CGPoint) -> CGAffineTransform { | |
| let bounds = view.bounds | |
| let anchorPoint = CGPoint(x: bounds.width * relativeAnchorPoint.x, y: bounds.height * relativeAnchorPoint.y) | |
| return CGAffineTransform.identity | |
| .translatedBy(x: anchorPoint.x, y: anchorPoint.y) | |
| .scaledBy(x: scale.x, y: scale.y) | |
| .translatedBy(x: -anchorPoint.x, y: -anchorPoint.y) | |
| } |
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 | |
| import PlaygroundSupport | |
| extension Double { | |
| func toRadians() -> Double { | |
| return self * Double.pi / 180 | |
| } | |
| func toCGFloat() -> CGFloat { | |
| return CGFloat(self) |
To disable iCloud sync of core data when the app launches, set the cloudKitContainerOptions to nil for the persistent store.
In your AppDelegate.swift file :
lazy var persistentContainer: NSPersistentCloudKitContainer = {
let container = NSPersistentCloudKitContainer(name: "your core data container name")
guard let description = container.persistentStoreDescriptions.first else {
fatalError("###\(#function): Failed to retrieve a persistent store description.")
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
| let overrideCatalystScaleFactor: Void = { | |
| guard let sceneViewClass = NSClassFromString("UINSSceneView") as? NSObject.Type else { | |
| return | |
| } | |
| if sceneViewClass.instancesRespond(to: NSSelectorFromString("scaleFactor")) { | |
| // old | |
| swizzleInstanceMethod( | |
| class: sceneViewClass, | |
| originalSelector: NSSelectorFromString("scaleFactor"), | |
| swizzledSelector: #selector(swizzle_scaleFactor) |
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
| // | |
| // CDView.swift | |
| // CD | |
| // | |
| // Created by Daniel Kuntz on 7/3/23. | |
| // | |
| import SwiftUI | |
| struct ShapeWithHole: Shape { |
