Adobe Creative SDK文件Swift

时间:2015-01-19 18:56:47

标签: xcode swift sdk adobe creative-cloud

我正在尝试在Swift中重写下面的代码。但是在Swift中, itemSelections 表示它必须是[AnyObject]的一种类型。有办法解决这个问题吗?感谢

Adob​​e代码

- (void)showFileChooser {

[[AdobeUXAssetBrowser sharedBrowser] popupFileBrowser:^(AdobeSelectionAssetArray *itemSelections) {
NSLog(@"Selected a file");
for(id item in itemSelections) {

AdobeAsset *it = ((AdobeSelectionAsset *)item).selectedItem;

NSLog(@"File name %@", it.name);
}
...

快速转换

AdobeUXAssetBrowser.sharedBrowser().popupFileBrowser({ (itemSelections:[AnyObject]!) -> Void in

1 个答案:

答案 0 :(得分:1)

这应该有效:

AdobeUXAssetBrowser.sharedBrowser().popupFileBrowser({ (itemSelections) in
    if let itemSelectionsAssets = itemSelections as? [AdobeSelectionAsset] {
        for itemSelectionAsset in itemSelectionsAssets {
            let item = itemSelectionAsset.selectedItem
            println("File name: \(item.name)")
        }
    }
}