古いプロジェクトをインポートしたので、それをSwift 3に変換するよう促しました。Swiftで高度に知識のない人は、エラーを修正するのが難しいです。 Error can be found at this imageタイプ 'Any'には添え字メンバーがありません - NSMutableArray
import Foundation
class CellDescriptorHelper {
let itemKey = "Items"
let isExpandableKey = "isExpandable"
let isExpandedKey = "isExpanded"
let isVisibleKey = "isVisible"
let titleKey = "title"
let locationKey = "location"
let descriptionKey = "description"
let imageURLKey = "imageURL"
let typeKey = "type"
let cellIdentifierKey = "cellIdentifier"
let additionalRowsKey = "additionalRows"
fileprivate var cellDescriptors: NSMutableArray!
fileprivate var cellsToDisplay: NSMutableArray!
func getCellDescriptors(_ type: String) -> NSMutableArray {
loadCellDescriptors(type)
return cellDescriptors;
}
func loadCellDescriptors(_ type: String) {
cellDescriptors = PlistManager.sharedInstance.getValueForKey(itemKey)! as! NSMutableArray
for i in 0..<(cellDescriptors[0] as AnyObject).count-1 {
let cellType = cellDescriptors[0][i][typeKey] as! String //creates error
if(cellType != type) {
cellDescriptors[0][i].setValue(false, forKey: isVisibleKey) //creates error
}
}
}
}
あなたのコードを画像ではなくテキストのように質問に入れてください。 – user28434
@ user28434こんにちは、私は投稿を編集しました。 – nkpg
@Honey - Swiftコードに関する質問にObjective-Cタグを追加したのはなぜですか? – rmaddy