This file contains hidden or 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
| coordinator.session.loadObjects(ofClass: Cat.self) { cats in | |
| collectionView.performBatchUpdates { | |
| for cat in cats as! [Cat] { | |
| self.viewModel.cats.insert(cat, at: destinationIndexPath.row) | |
| } | |
| collectionView.reloadSections(IndexSet(integer: destinationIndexPath.section)) | |
| } | |
| } |
This file contains hidden or 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 collectionView(_ collectionView: UICollectionView, dropSessionDidUpdate session: UIDropSession, withDestinationIndexPath destinationIndexPath: IndexPath?) -> UICollectionViewDropProposal { | |
| let operation: UIDropOperation = session.localDragSession == nil ? .copy : .move | |
| let intent = UICollectionViewDropIntent.insertAtDestinationIndexPath | |
| let dropProposal = UICollectionViewDropProposal(operation: operation, intent: intent) | |
| return dropProposal | |
| } |
This file contains hidden or 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
| for item in session.items { | |
| item.itemProvider.loadObject... | |
| } |
This file contains hidden or 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 dropInteraction(_ interaction: UIDropInteraction, performDrop session: UIDropSession) { | |
| session.loadObjects(ofClass: NSString.self) { item in | |
| DispatchQueue.main.async { | |
| label.text = item as NSString as String | |
| } | |
| } | |
| } |
This file contains hidden or 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 dropInteraction(_ interaction: UIDropInteraction, sessionDidUpdate session: UIDropSession) -> UIDropProposal { | |
| return UIDropProposal(operation: .copy) | |
| } |
This file contains hidden or 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 dropInteraction(_ interaction: UIDropInteraction, canHandle session: UIDropSession) -> Bool { | |
| return session.hasItemsConforming(toTypeIdentifiers: [kUTTypePlainText as String]) | |
| } |
This file contains hidden or 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 dragInteraction(_ interaction: UIDragInteraction, itemsForBeginning session: UIDragSession) -> [UIDragItem] { | |
| let provider = NSItemProvider(object: "Hello" as NSString) | |
| return [UIDragItem(itemProvider: provider)] | |
| } |
This file contains hidden or 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
| 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 | |
| } |
This file contains hidden or 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
| // example your_app_dir/.bundle/config | |
| — - | |
| BUNDLE_PATH: “.gems” | |
| BUNDLE_DISABLE_SHARED_GEMS: “true” |
This file contains hidden or 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
| //example Gemfile | |
| source ‘https://rubygems.org' | |
| gem ‘cocoapods’ | |
| gem ‘cocoapods-keys’ | |
| gem ‘redcarpet’ | |
| gem ‘rswift-ios’ |