Skip to content

Commit

Permalink
Fix minor issues with builds
Browse files Browse the repository at this point in the history
  • Loading branch information
mayankk2308 committed Jun 29, 2019
1 parent c3336c9 commit cb38cc9
Show file tree
Hide file tree
Showing 4 changed files with 177 additions and 13 deletions.
20 changes: 8 additions & 12 deletions MKDataDetector.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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;
Expand All @@ -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";
Expand Down Expand Up @@ -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;
Expand All @@ -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 = "";
Expand All @@ -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;
};
Expand All @@ -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 = "";
Expand All @@ -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;
};
Expand All @@ -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;
};
Expand All @@ -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;
};
Expand Down
2 changes: 1 addition & 1 deletion MKDataDetector.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

164 changes: 164 additions & 0 deletions TestGround-tvOS.playground/Contents.swift
Original file line number Diff line number Diff line change
@@ -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
}
}
}
4 changes: 4 additions & 0 deletions TestGround-tvOS.playground/contents.xcplayground
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='5.0' target-platform='tvos'>
<timeline fileName='timeline.xctimeline'/>
</playground>

0 comments on commit cb38cc9

Please sign in to comment.