This file contains 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
let shortcutExample = UIMutableApplicationShortcutItem(type: "my_app_basic_shortcut", localizedTitle: "Name") | |
shortcutExample.type = "my_app_basic_shortcut" // identify for your shortcut item (MUST EXIST) | |
shortcutExample.localizedTitle = "Name" // name of shortcut (MUST EXIST) | |
shortcutExample.localizedSubtitle = "Info about action" // subtitle of shortcut | |
shortcutExample.icon = UIApplicationShortcutIcon(type: .update) // inco of shortcut, will be discribed later | |
shortcutExample.userInfo = ["NoteItem": note as NSSecureCoding] // additional info, must be [String : NSSecureCoding] | |
// Update the application providing the initial 'dynamic' shortcut items. | |
application.shortcutItems = [shortcutExample] |
This file contains 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
func application(_ application: UIApplication, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void) { | |
let handled = handleShortcutItem(shortcutItem) | |
completionHandler(handled) | |
} | |
func handleShortcutItem(_ shortcutItem: UIApplicationShortcutItem) -> Bool { | |
if shortcutItem.type != basicShortcutTypeString { | |
return false | |
} | |
This file contains 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
if traitCollection.forceTouchCapability == .available { | |
registerForPreviewing(with: self, sourceView: view) | |
} |
This file contains 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 ViewController: UIViewControllerPreviewingDelegate { | |
func previewingContext(_ previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController? { | |
let viewController = UIViewController() | |
// ... | |
return viewController | |
} | |
func previewingContext(_ previewingContext: UIViewControllerPreviewing, commit viewControllerToCommit: UIViewController) { | |
// ... | |
} |
This file contains 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
func previewingContext(_ previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController? { | |
guard let indexPath = collectionView.indexPathForItem(at: location), | |
let cell = collectionView.cellForItem(at: indexPath) else { return nil } | |
guard let detailViewController = storyboard?.instantiateViewControllerWithIdentifier("ColorViewController") as? ColorViewController else { return nil } | |
detailViewController.preferredContentSize = CGSize(width: 300, height: 300) | |
detailViewController.color = colors[indexPath.row] | |
previewingContext.sourceRect = cell.frame |
This file contains 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
func previewingContext(_ previewingContext: UIViewControllerPreviewing, commit viewControllerToCommit: UIViewController) { | |
show(viewControllerToCommit, sender: nil) | |
} |
This file contains 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
post_install do |installer| | |
installer.pods_project.targets.each do |target| | |
target.build_configurations.each do |configuration| | |
configuration.build_settings['SWIFT_VERSION'] = "2.3" | |
end | |
end | |
end |
This file contains 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
developer_info = { | |
"DevelopmentTeam" => "5-------S4", | |
"DevelopmentTeamName" => "Alexander Zimin" | |
} | |
post_install do |installer| | |
path = installer.pods_project.path | |
pbxproj_path = path + 'project.pbxproj' | |
unless File.exist?(pbxproj_path) |
This file contains 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
# Uncomment this line to define a global platform for your project | |
# platform :ios, '9.0' | |
target 'YouApp' do | |
use_frameworks! | |
# Pods for YouApp | |
pod 'SwiftFramework', :branch => 'swift-2.3' | |
end |
This file contains 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
#!/bin/sh | |
# | |
# An example hook script to prepare the commit log message. | |
# Called by "git commit" with the name of the file that has the | |
# commit message, followed by the description of the commit | |
# message's source. The hook's purpose is to edit the commit | |
# message file. If the hook fails with a non-zero status, | |
# the commit is aborted. | |
# |
OlderNewer