Slide 18
Slide 18 text
Dropͷ࣮ํ๏(ͦͷ2)
@available(iOS 11.0, *)
extension RegisterViewController: UIDropInteractionDelegate {
func dropInteraction(_ interaction: UIDropInteraction, canHandle session: UIDropSession) -> Bool {
return session.canLoadObjects(ofClasses: [UIImage.self])
}
func dropInteraction(_ interaction: UIDropInteraction, sessionDidUpdate session: UIDropSession) -> UIDropProposal {
return UIDropProposal(operation: .copy)
}
func dropInteraction(_ interaction: UIDropInteraction, performDrop session: UIDropSession) {
session.loadObjects(ofClass: UIImage.self) { (items) in
items.forEach({ (item) in
guard let image: UIImage = item as? UIImage else { return }
self.upload(image)
})
}
}
}
18