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
// | |
// MIT LICENSE: Copy past as much as you want :) | |
// | |
// Your signal, array of length 1024 | |
let signal: [Float] = (0 ... 1024) | |
// --- INITIALIZATION | |
// The length of the input | |
length = vDSP_Length(signal.count) |
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 UITextView { | |
// Massive credit to Dave Delong for his extensive help with this solution. | |
/// Returns whether or not the `UITextView` is displaying truncated text. This includes text | |
/// that is visually truncated with an ellipsis (...), and text that is simply cut off through | |
/// word wrapping. | |
/// | |
/// - Important: | |
/// This only works properly when the `NSLineBreakMode` is set to `.byTruncatingTail` or `.byWordWrapping`. | |
/// | |
/// - Remark: |
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 UnicodeScalar { | |
/// Note: This method is part of Swift 5, so you can omit this. | |
/// See: https://developer.apple.com/documentation/swift/unicode/scalar | |
var isEmoji: Bool { | |
switch value { | |
case 0x1F600...0x1F64F, // Emoticons | |
0x1F300...0x1F5FF, // Misc Symbols and Pictographs | |
0x1F680...0x1F6FF, // Transport and Map |