Avatar
@swift-5.1.5 import Foundation let data = Data([1, 2, 3]) let tests = [Data([1]), Data([1, 2]), Data([1, 2, 3])] for test in tests { let range = (data as NSData).firstRange(of: test) print("\(range)") } (edited)