diff --git a/MKDataDetector.xcodeproj/project.pbxproj b/MKDataDetector.xcodeproj/project.pbxproj index 99703e6..5720046 100644 --- a/MKDataDetector.xcodeproj/project.pbxproj +++ b/MKDataDetector.xcodeproj/project.pbxproj @@ -339,6 +339,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD)"; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; @@ -392,13 +393,12 @@ ONLY_ACTIVE_ARCH = YES; PRODUCT_NAME = MKDataDetector; SDKROOT = ""; - SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator"; + SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvsimulator appletvos watchsimulator watchos"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = "1,2"; TVOS_DEPLOYMENT_TARGET = 9.0; - VALID_ARCHS = "arm64 armv7 armv7s x86_64"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; WATCHOS_DEPLOYMENT_TARGET = 2.0; @@ -409,6 +409,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD)"; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; @@ -455,13 +456,12 @@ MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_NAME = MKDataDetector; SDKROOT = ""; - SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator"; + SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvsimulator appletvos watchsimulator watchos"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = "1,2"; TVOS_DEPLOYMENT_TARGET = 9.0; VALIDATE_PRODUCT = YES; - VALID_ARCHS = "arm64 armv7 armv7s x86_64"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; WATCHOS_DEPLOYMENT_TARGET = 2.0; @@ -486,7 +486,6 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MARKETING_VERSION = 2.0.3; - ONLY_ACTIVE_ARCH = NO; PRODUCT_BUNDLE_IDENTIFIER = com.mayank.MKDataDetector; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -496,8 +495,6 @@ SWIFT_OPTIMIZATION_LEVEL = "-O"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2,3,4"; - TVOS_DEPLOYMENT_TARGET = 9.0; - WATCHOS_DEPLOYMENT_TARGET = 2.0; }; name = Debug; }; @@ -519,7 +516,6 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MARKETING_VERSION = 2.0.3; - ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.mayank.MKDataDetector; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -528,8 +524,6 @@ SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2,3,4"; - TVOS_DEPLOYMENT_TARGET = 9.0; - WATCHOS_DEPLOYMENT_TARGET = 2.0; }; name = Release; }; @@ -549,8 +543,9 @@ PRODUCT_BUNDLE_IDENTIFIER = com.mayank.MKDataDetectorTests; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; - SDKROOT = macosx; + SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator"; SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2,3"; }; name = Debug; }; @@ -570,8 +565,9 @@ PRODUCT_BUNDLE_IDENTIFIER = com.mayank.MKDataDetectorTests; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; - SDKROOT = macosx; + SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator"; SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2,3"; }; name = Release; }; diff --git a/MKDataDetector.xcworkspace/contents.xcworkspacedata b/MKDataDetector.xcworkspace/contents.xcworkspacedata index 724f995..ddc6b79 100644 --- a/MKDataDetector.xcworkspace/contents.xcworkspacedata +++ b/MKDataDetector.xcworkspace/contents.xcworkspacedata @@ -2,7 +2,7 @@ + location = "absolute:/Users/mayank/Library/CloudStorage/iCloud Drive/Documents/Projects/MKDataDetector/TestGround-tvOS.playground"> diff --git a/TestGround-tvOS.playground/Contents.swift b/TestGround-tvOS.playground/Contents.swift new file mode 100644 index 0000000..4cdab74 --- /dev/null +++ b/TestGround-tvOS.playground/Contents.swift @@ -0,0 +1,164 @@ +// Test below - delete tests before commits, or exclude this file in your commits +import MKDataDetector +import CoreLocation +import UIKit + +let dataDetectorService = MKDataDetectorService() + +let textBody = "hello world at 9pm tomorrow" +let textBodies = ["event on monday", "movie on wednesday", "payment due next thursday", "time", "money", "yellowstone park visit next friday", "party next friday at 8pm"] + +let address = "5123 Kere street, get here fast MA 01003, USA" +let legalAddress = "133 Belchertown Rd Amherst MA - 01003 United States" +let addresses = ["B713, Samartha Aangan II, Oshiwara, Andheri West, Mumbai - 400053, India", "133 Belchertown Rd Amherst MA - 01003 United States"] + +let link = "Mayank's Github: https://github.com/mayankk2308" +let links = [link, "another link ://ssdsd", "testlink://", "www.apple.com", "http://apple.com"] + +let phone = "Mayank: +1 (413) 801 6324" +let phones = ["+14138016324", "Mayank: +91 9920095040", "400053"] + +let transit = "UA 2392" +let transits = ["Flight 2334", "EK 239 to Boston", "Emirates Airlines", "United Flight 2223"] + +print("-----Single Body Date Results-----\n") +if let singleBodyDateResults = dataDetectorService.extractDates(fromTextBody: textBody) { + for result in singleBodyDateResults { + print(result.source) + print(result.data) + print() + } +} + +print("\n-----Multiple Bodies Date Results-----\n") + +if let combinedDateResults = dataDetectorService.extractDates(fromTextBodies: textBodies) { + for individualResults in combinedDateResults { + for result in individualResults { + print(result.source) + print(result.data) + print() + } + } +} + +print("\n-----Single Body Address Results-----\n") + +if let addressResults = dataDetectorService.extractAddresses(fromTextBody: address) { + for result in addressResults { + print(result.source) + print(result.data) + print() + } +} + +print("\n-----Multiple Bodies Address Results-----\n") + +if let combinedAddressResults = dataDetectorService.extractAddresses(fromTextBodies: addresses) { + for individualResults in combinedAddressResults { + for result in individualResults { + print(result.source) + print(result.data) + print() + } + } +} + +print("\n-----Single Body URL Results-----\n") + +if let URLResults = dataDetectorService.extractLinks(fromTextBody: link) { + for result in URLResults { + print(result.source) + print(result.data) + print() + } +} + +print("\n-----Multiple Bodies URL Results-----\n") + +if let combinedURLResults = dataDetectorService.extractLinks(fromTextBodies: links) { + for individualResults in combinedURLResults { + for result in individualResults { + print(result.source) + print(result.data) + print() + } + } +} + +print("\n-----Single Body Phone Results-----\n") + +if let phoneResults = dataDetectorService.extractPhoneNumbers(fromTextBody: phone) { + for result in phoneResults { + print(result.source) + print(result.data) + print() + } +} + +print("\n-----Multiple Bodies Phone Results-----\n") + +if let combinedPhoneResults = dataDetectorService.extractPhoneNumbers(fromTextBodies: phones) { + for individualResults in combinedPhoneResults { + for result in individualResults { + print(result.source) + print(result.data) + print() + } + } +} + +print("\n-----Single Body Transit Results-----\n") + +if let transitResults = dataDetectorService.extractTransitInformation(fromTextBody: transit) { + for result in transitResults { + print(result.source) + print(result.data) + print() + } +} + +print("\n-----Multiple Bodies Transit Results-----\n") + +if let combinedTransitResults = dataDetectorService.extractTransitInformation(fromTextBodies: transits) { + for individualResults in combinedTransitResults { + for result in individualResults { + print(result.source) + print(result.data) + print() + } + } +} + +print("\n-----Basic Scenario Implementation Results-----\n") + +print(textBody.dates!) +print(link.links!) +print(transit.transitInfo!) +print(address.addresses!) +print(phone.phoneNumbers!) + +print("\n-----Mixed Request Results-----\n") + +let mixedText = "Call Mayank on +1123456789 on 2017/13/12 at 5pm when you reach 990 Belchertown Rd, Amherst, MA - 01440 USA." + +if let results = dataDetectorService.extractInformation(fromTextBody: mixedText, withResultTypes: .date, .address, .phoneNumber) { + for result in results { + switch result.dataType { + case .date: + let date = result.data as! Date + print(date) + break + case .address: + let address = result.data as! AddressInfo + print(address) + break + case .phoneNumber: + let phoneNumber = result.data as! String + print(phoneNumber) + break + default: + continue + } + } +} diff --git a/TestGround-tvOS.playground/contents.xcplayground b/TestGround-tvOS.playground/contents.xcplayground new file mode 100644 index 0000000..10d79fc --- /dev/null +++ b/TestGround-tvOS.playground/contents.xcplayground @@ -0,0 +1,4 @@ + + + + \ No newline at end of file