- In terminal type
defaults write com.apple.LaunchServices/com.apple.launchservices.secure LSHandlers -array-add \
'{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=<program bundle id>;}'
ex. for SublimeText 2
sudo dscl . append /Users/`users` AuthenticationAuthority ";AppleID;[email protected]" |
defaults write com.apple.LaunchServices/com.apple.launchservices.secure LSHandlers -array-add \
'{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=<program bundle id>;}'
ex. for SublimeText 2
#How to use Bundler with iOS projects
You probably stuck with situation when after finishing for example bundle install && bundle exec pod install
Bundler couldn't access gems which he just download. Some of you may think "RVM is the answer!" and yes it is, but what if it is not?
##Don't use macOS's gems. Just DON'T.
your_app_dir
Gemfile
if not create one//example Gemfile | |
source ‘https://rubygems.org' | |
gem ‘cocoapods’ | |
gem ‘cocoapods-keys’ | |
gem ‘redcarpet’ | |
gem ‘rswift-ios’ |
// example your_app_dir/.bundle/config | |
— - | |
BUNDLE_PATH: “.gems” | |
BUNDLE_DISABLE_SHARED_GEMS: “true” |
collectionView.pasteConfiguration = UIPasteConfiguration(forAccepting: UIImage.self) | |
... | |
override func paste(itemProviders: [NSItemProvider]) { | |
for provider in itemProviders { | |
provider.loadObject(ofClass: UIImage.self, completionHandler: { item, error in | |
guard error == nil else { | |
return | |
} |
func dragInteraction(_ interaction: UIDragInteraction, itemsForBeginning session: UIDragSession) -> [UIDragItem] { | |
let provider = NSItemProvider(object: "Hello" as NSString) | |
return [UIDragItem(itemProvider: provider)] | |
} |
func dropInteraction(_ interaction: UIDropInteraction, canHandle session: UIDropSession) -> Bool { | |
return session.hasItemsConforming(toTypeIdentifiers: [kUTTypePlainText as String]) | |
} |
func dropInteraction(_ interaction: UIDropInteraction, sessionDidUpdate session: UIDropSession) -> UIDropProposal { | |
return UIDropProposal(operation: .copy) | |
} |
func dropInteraction(_ interaction: UIDropInteraction, performDrop session: UIDropSession) { | |
session.loadObjects(ofClass: NSString.self) { item in | |
DispatchQueue.main.async { | |
label.text = item as NSString as String | |
} | |
} | |
} |