Skip to content

Instantly share code, notes, and snippets.

View icanswiftabit's full-sized avatar
⌨️

Błażej Wdowikowski icanswiftabit

⌨️
View GitHub Profile
@icanswiftabit
icanswiftabit / bash command for using iCloud password
Created October 17, 2016 14:51
When iCloud prompt is not showing in user & groups, type this command to.
sudo dscl . append /Users/`users` AuthenticationAuthority ";AppleID;[email protected]"
@icanswiftabit
icanswiftabit / readme.md
Last active January 7, 2017 17:35
Set default program for text edition in macOS 10.11+
  • 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

@icanswiftabit
icanswiftabit / bundlerInIOS.MD
Last active April 6, 2024 14:54
How to use bundler with iOS projects

#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.

  1. Establish that you will don't use macOS's gems and RVM.
  2. Go to your_app_dir
  3. Make sure you have 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
}
}
}