0
내가 스위프트에 목표 C에서 다음 코드를 변환하는 데 어려움을 겪고있어 목표 C로 코딩 된 레이 Wenderlich 튜토리얼 다음은 PLIST에서 테이블을 채우는있어 데이터가있는 테이블을 채우기 :PLIST
var sortDescriptor:NSSortDescriptor = NSSortDescriptor(key: nil, ascending: true, selector: "localizedCompare:")
내가 다음 줄 I를 시도 할 때 내가 전화
에서 다음그리고 "를 추가 인수 '선택'을 알리는 컴파일러 오류가있어 다음과 같이 I 변환
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
NSSortDescriptor* sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:nil ascending:YES selector:@selector(localizedCompare:)];
NSArray* sortedCategories = [self.articleDictionary.allKeys sortedArrayUsingDescriptors:[NSArray arrayWithObject:sortDescriptor]];
NSString *categoryName = [sortedCategories objectAtIndex:section];
NSArray *currentCategory = [self.articleDictionary objectForKey:categoryName];
return [currentCategory count];
}
Xcode를 사용하여 다음과 같이 제안하십시오.
let sortedCategories:NSArray = [articleDictionary.allKeys.sort(<#isOrderedBefore: (AnyObject, AnyObject) -> Bool##(AnyObject, AnyObject) -> Bool#>)]
의견이 있으십니까?