2016-11-23 2 views
2

프레임 워크 GlyuckDataGrid을 사용하여 Objective-C에 DataGrid를 구현했습니다. IndexPath+DataGrid.swift이라는 확장 기능이 DataGrid의 구현에 필수적이지만 Swift로 작성되었습니다.Objective-C에서 Swift 확장에 액세스하려면 어떻게해야합니까?

CocoaPods를 사용하고 있는데 다음과 같은 가져 오기 기능을 사용할 수 있지만 여전히 액세스 할 수 없습니다.

@import GlyuckDataGrid; 
#import <GlyuckDataGrid/GlyuckDataGrid-Swift.h> 

E : 이제 난 내 솔루션에 대한 답을 가지고, 내가 IndexPathNSIndexPath을 간과 것을 지적하고 싶다. 나 do not는 2를 혼동한다.

+0

확장 프로그램을 공개로 표시해야하며 확장 프로그램을 브리지 유형에 정의 할 수 없습니다. – Whakkee

+0

@Whakkee 아픈 포크와 내일 확인하십시오. – Multinerd

답변

2

프레임 워크는 Objective-C equivalent (NSIndexPath) 대신 pure Swift 타입 (IndexPath)을 사용했다. 귀하의 경우에는,이 솔루션은 오브젝티브 C로 기능을 노출하는 NSIndexPath뿐만 아니라 IndexPath을 확장했다 : c281729에서

public extension NSIndexPath { 
    /** 
    Returns an index-path object initialized with the indexes of a specific row and column in a data grid view. 
    - parameter column: An index number identifying a column in a DataGridView object in a row identified by the row parameter. 
    - parameter row: An index number identifying a row in a DataGridView object. 
    - returns: An NSIndexPath object. 
    */ 
    convenience init(forColumn column: Int, row: Int) { 
     self.init(item: column, section: row) 
    } 

    /// An index number identifying a column in a row of a data grid view. (read-only) 
    var dataGridColumn: Int { 
     return self.index(atPosition: 1) 
    } 

    /// An index number identifying a row in a data grid view. (read-only) 
    var dataGridRow: Int { 
     return self.index(atPosition: 0) 
    } 

    /// An index number for single-item indexPath 
    var index: Int { 
     return self.index(atPosition: 0) 
    } 
} 

.

+0

고맙다. 내가 할 수 있기 전에 더 높은 ups 중 하나가 그것을 삭제했다. – Multinerd

관련 문제