浏览代码

VLCActionSheet: Make didSelectItem optional

Soomin Lee 6 年之前
父节点
当前提交
c95f7c3277
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      Sources/VLCActionSheet/VLCActionSheet.swift

+ 2 - 2
Sources/VLCActionSheet/VLCActionSheet.swift

@@ -20,7 +20,7 @@ import UIKit
 @objc protocol VLCActionSheetDelegate {
     @objc optional func headerViewTitle() -> String?
     @objc func itemAtIndexPath(_ indexPath: IndexPath) -> Any?
-    @objc func actionSheet(collectionView: UICollectionView, didSelectItem item: Any, At indexPath: IndexPath)
+    @objc optional func actionSheet(collectionView: UICollectionView, didSelectItem item: Any, At indexPath: IndexPath)
 }
 
 // MARK: VLCActionSheet
@@ -298,7 +298,7 @@ extension VLCActionSheet: UICollectionViewDelegateFlowLayout {
 extension VLCActionSheet: UICollectionViewDelegate {
     func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
         if let delegate = delegate, let item = delegate.itemAtIndexPath(indexPath) {
-            delegate.actionSheet(collectionView: collectionView, didSelectItem: item, At: indexPath)
+            delegate.actionSheet?(collectionView: collectionView, didSelectItem: item, At: indexPath)
             action?(item)
         }
         removeActionSheet()