mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-03-29 13:51:48 +02:00
corespotlight test
This commit is contained in:
@@ -40,6 +40,8 @@
|
|||||||
B5BDC9231C202429008147CD /* CoreStore.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = B5BDC9211C202429008147CD /* CoreStore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
B5BDC9231C202429008147CD /* CoreStore.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = B5BDC9211C202429008147CD /* CoreStore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||||
B5BDC9251C202429008147CD /* GCDKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5BDC9241C202429008147CD /* GCDKit.framework */; };
|
B5BDC9251C202429008147CD /* GCDKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5BDC9241C202429008147CD /* GCDKit.framework */; };
|
||||||
B5BDC9261C202429008147CD /* GCDKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = B5BDC9241C202429008147CD /* GCDKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
B5BDC9261C202429008147CD /* GCDKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = B5BDC9241C202429008147CD /* GCDKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||||
|
B5C12CE71C21B2F70098E05F /* CoreSpotlight.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5C12CE61C21B2F70098E05F /* CoreSpotlight.framework */; };
|
||||||
|
B5C12CE91C21B2FD0098E05F /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5C12CE81C21B2FD0098E05F /* MobileCoreServices.framework */; };
|
||||||
B5E599321B5240F50084BD5F /* OrganismTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E599311B5240F50084BD5F /* OrganismTableViewCell.swift */; };
|
B5E599321B5240F50084BD5F /* OrganismTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E599311B5240F50084BD5F /* OrganismTableViewCell.swift */; };
|
||||||
B5EE25851B36E23C0000406B /* OrganismV1.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5EE25841B36E23C0000406B /* OrganismV1.swift */; };
|
B5EE25851B36E23C0000406B /* OrganismV1.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5EE25841B36E23C0000406B /* OrganismV1.swift */; };
|
||||||
B5EE25871B36E2520000406B /* OrganismV2.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5EE25861B36E2520000406B /* OrganismV2.swift */; };
|
B5EE25871B36E2520000406B /* OrganismV2.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5EE25861B36E2520000406B /* OrganismV2.swift */; };
|
||||||
@@ -97,6 +99,8 @@
|
|||||||
B5A93A131C214E5900E47273 /* SpotlightDemoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SpotlightDemoViewController.swift; sourceTree = "<group>"; };
|
B5A93A131C214E5900E47273 /* SpotlightDemoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SpotlightDemoViewController.swift; sourceTree = "<group>"; };
|
||||||
B5BDC9211C202429008147CD /* CoreStore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = CoreStore.framework; path = "/Users/JohnEstropia/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphoneos/CoreStore.framework"; sourceTree = "<absolute>"; };
|
B5BDC9211C202429008147CD /* CoreStore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = CoreStore.framework; path = "/Users/JohnEstropia/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphoneos/CoreStore.framework"; sourceTree = "<absolute>"; };
|
||||||
B5BDC9241C202429008147CD /* GCDKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = GCDKit.framework; path = "/Users/JohnEstropia/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphoneos/GCDKit.framework"; sourceTree = "<absolute>"; };
|
B5BDC9241C202429008147CD /* GCDKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = GCDKit.framework; path = "/Users/JohnEstropia/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphoneos/GCDKit.framework"; sourceTree = "<absolute>"; };
|
||||||
|
B5C12CE61C21B2F70098E05F /* CoreSpotlight.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreSpotlight.framework; path = System/Library/Frameworks/CoreSpotlight.framework; sourceTree = SDKROOT; };
|
||||||
|
B5C12CE81C21B2FD0098E05F /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; };
|
||||||
B5E599311B5240F50084BD5F /* OrganismTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = OrganismTableViewCell.swift; path = "CoreStoreDemo/MIgrations Demo/OrganismTableViewCell.swift"; sourceTree = SOURCE_ROOT; };
|
B5E599311B5240F50084BD5F /* OrganismTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = OrganismTableViewCell.swift; path = "CoreStoreDemo/MIgrations Demo/OrganismTableViewCell.swift"; sourceTree = SOURCE_ROOT; };
|
||||||
B5EE25801B36E1B00000406B /* MigrationDemoV2.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = MigrationDemoV2.xcdatamodel; sourceTree = "<group>"; };
|
B5EE25801B36E1B00000406B /* MigrationDemoV2.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = MigrationDemoV2.xcdatamodel; sourceTree = "<group>"; };
|
||||||
B5EE25841B36E23C0000406B /* OrganismV1.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrganismV1.swift; sourceTree = "<group>"; };
|
B5EE25841B36E23C0000406B /* OrganismV1.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrganismV1.swift; sourceTree = "<group>"; };
|
||||||
@@ -112,6 +116,8 @@
|
|||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
B5C12CE91C21B2FD0098E05F /* MobileCoreServices.framework in Frameworks */,
|
||||||
|
B5C12CE71C21B2F70098E05F /* CoreSpotlight.framework in Frameworks */,
|
||||||
B52977E11B120F8A003D50A5 /* CoreLocation.framework in Frameworks */,
|
B52977E11B120F8A003D50A5 /* CoreLocation.framework in Frameworks */,
|
||||||
B5BDC9221C202429008147CD /* CoreStore.framework in Frameworks */,
|
B5BDC9221C202429008147CD /* CoreStore.framework in Frameworks */,
|
||||||
B5BDC9251C202429008147CD /* GCDKit.framework in Frameworks */,
|
B5BDC9251C202429008147CD /* GCDKit.framework in Frameworks */,
|
||||||
@@ -146,6 +152,8 @@
|
|||||||
B52977E21B120F90003D50A5 /* Frameworks */ = {
|
B52977E21B120F90003D50A5 /* Frameworks */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
B5C12CE81C21B2FD0098E05F /* MobileCoreServices.framework */,
|
||||||
|
B5C12CE61C21B2F70098E05F /* CoreSpotlight.framework */,
|
||||||
B52977E01B120F8A003D50A5 /* CoreLocation.framework */,
|
B52977E01B120F8A003D50A5 /* CoreLocation.framework */,
|
||||||
B5BDC9211C202429008147CD /* CoreStore.framework */,
|
B5BDC9211C202429008147CD /* CoreStore.framework */,
|
||||||
B5BDC9241C202429008147CD /* GCDKit.framework */,
|
B5BDC9241C202429008147CD /* GCDKit.framework */,
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
import CoreSpotlight
|
||||||
|
|
||||||
|
|
||||||
// MARK: - AppDelegate
|
// MARK: - AppDelegate
|
||||||
@@ -23,5 +24,25 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||||||
application.statusBarStyle = .LightContent
|
application.statusBarStyle = .LightContent
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func application(application: UIApplication, continueUserActivity userActivity: NSUserActivity, restorationHandler: ([AnyObject]?) -> Void) -> Bool {
|
||||||
|
|
||||||
|
guard #available(iOS 9.0, *) else {
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
guard userActivity.activityType == CSSearchableItemActionType,
|
||||||
|
let identifier = userActivity.userInfo?[CSSearchableItemActivityIdentifier] as? String else {
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
let alert = UIAlertController(title: identifier, message: "You have tapped \(identifier)", preferredStyle: .Alert)
|
||||||
|
alert.addAction(UIAlertAction(title: "OK", style: .Default, handler: nil))
|
||||||
|
self.window?.rootViewController?.presentViewController(alert, animated: true, completion: nil)
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import CoreSpotlight
|
import CoreSpotlight
|
||||||
|
import MobileCoreServices
|
||||||
|
|
||||||
|
|
||||||
// MARK: - SpotlightDemoViewController
|
// MARK: - SpotlightDemoViewController
|
||||||
@@ -41,25 +42,66 @@ class SpotlightDemoViewController: UITableViewController {
|
|||||||
|
|
||||||
override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
|
override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
|
||||||
|
|
||||||
if case .Delete = editingStyle {
|
guard case .Delete = editingStyle else {
|
||||||
|
|
||||||
tableView.beginUpdates()
|
return
|
||||||
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Automatic)
|
|
||||||
self.dataSource.removeAtIndex(indexPath.row)
|
|
||||||
tableView.endUpdates()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let identifier = self.dataSource[indexPath.row].0
|
||||||
|
if #available(iOS 9.0, *) {
|
||||||
|
|
||||||
|
CSSearchableIndex.defaultSearchableIndex().deleteSearchableItemsWithIdentifiers(
|
||||||
|
[identifier],
|
||||||
|
completionHandler: { error in
|
||||||
|
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
tableView.beginUpdates()
|
||||||
|
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Automatic)
|
||||||
|
self.dataSource.removeAtIndex(indexPath.row)
|
||||||
|
tableView.endUpdates()
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: Private
|
// MARK: Private
|
||||||
|
|
||||||
@IBAction private dynamic func addBarButtonTapped(sender: UIBarButtonItem) {
|
@IBAction private dynamic func addBarButtonTapped(sender: UIBarButtonItem) {
|
||||||
|
|
||||||
let items = [("John", "iOS team"), ("Bob", "Android team"), ("Joe", "Infra team"), ("Ryan", "Director"), ("Jake", "Design team"), ("Mark", "Testing team")]
|
let items = [
|
||||||
|
("John", "iOS team"),
|
||||||
|
("Bob", "Android team"),
|
||||||
|
("Joe", "Infra team"),
|
||||||
|
("Ryan", "Director"),
|
||||||
|
("Jake", "Design team"),
|
||||||
|
("Mark", "Testing team")
|
||||||
|
]
|
||||||
guard let nextItem = items.filter({ !self.dataSource.map({ $0.0 }).contains($0.0) }).first else {
|
guard let nextItem = items.filter({ !self.dataSource.map({ $0.0 }).contains($0.0) }).first else {
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if #available(iOS 9.0, *) {
|
||||||
|
|
||||||
|
let attributeSet = CSSearchableItemAttributeSet(itemContentType: kUTTypeJSON as String)
|
||||||
|
attributeSet.title = nextItem.0
|
||||||
|
attributeSet.contentDescription = nextItem.1
|
||||||
|
|
||||||
|
let item = CSSearchableItem(
|
||||||
|
uniqueIdentifier: nextItem.0,
|
||||||
|
domainIdentifier: "jp.eureka.sample",
|
||||||
|
attributeSet: attributeSet
|
||||||
|
)
|
||||||
|
CSSearchableIndex.defaultSearchableIndex().indexSearchableItems(
|
||||||
|
[item],
|
||||||
|
completionHandler: { (error) -> Void in
|
||||||
|
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
let tableView = self.tableView
|
let tableView = self.tableView
|
||||||
tableView.beginUpdates()
|
tableView.beginUpdates()
|
||||||
tableView.insertRowsAtIndexPaths([NSIndexPath(forRow: self.dataSource.count, inSection: 0)], withRowAnimation: .Automatic)
|
tableView.insertRowsAtIndexPaths([NSIndexPath(forRow: self.dataSource.count, inSection: 0)], withRowAnimation: .Automatic)
|
||||||
|
|||||||
Reference in New Issue
Block a user