One Paragraph of project description goes here
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
| // | |
| // Keyboard.swift | |
| // | |
| // Created by Bojan Percevic on 5/21/15. | |
| // Copyright (c) 2015 Bojan Percevic. All rights reserved. | |
| // | |
| import AppKit | |
| enum Key: CUnsignedShort { |
| func appendToPath(path: CGMutablePath) | |
| { | |
| let textPath = CGPathCreateMutable() | |
| let attributedString = NSAttributedString(string: string) | |
| let line = CTLineCreateWithAttributedString(attributedString) | |
| // direct cast to typed array fails for some reason | |
| let runs = (CTLineGetGlyphRuns(line) as [AnyObject]) as! [CTRun] |
| /* | |
| Erica Sadun, http://ericasadun.com | |
| Cross Platform Defines | |
| Apple Platforms Only | |
| Will update to #if canImport() when available | |
| */ |
| #import <AVFoundation/AVFoundation.h> | |
| @interface MLWAsyncAVPlayer : AVPlayer | |
| @end |
| #import <AVFoundation/AVFoundation.h> | |
| @interface MLWAsyncAVPlayer : AVPlayer | |
| @end |
| fileprivate let badChars = CharacterSet.alphanumerics.inverted | |
| extension String { | |
| var uppercasingFirst: String { | |
| return prefix(1).uppercased() + dropFirst() | |
| } | |
| var lowercasingFirst: String { | |
| return prefix(1).lowercased() + dropFirst() | |
| } |
| public extension CGPoint { | |
| // The target points after decelerating to 0 velocity at a constant rate | |
| func target(initialVelocity: CGPoint, decelerationRate: CGFloat = UIScrollView.DecelerationRate.normal.rawValue) -> CGPoint { | |
| let x = self.x + self.x.target(initialVelocity: initialVelocity.x, decelerationRate: decelerationRate) | |
| let y = self.y + self.y.target(initialVelocity: initialVelocity.y, decelerationRate: decelerationRate) | |
| return CGPoint(x: x, y: y) | |
| } | |
| } |
Worth a read for some more context.
Create the file in the root of the project (where your Package.swift file lives as well), and use the following contents:
/// Package.xcconfig| import Combine | |
| import ReactiveSwift | |
| import SwiftUI | |
| class AnySubscription: Subscription { | |
| private let cancelable: Cancellable | |
| init(cancelable: Cancellable) { | |
| self.cancelable = cancelable |