我在Objective-C
中有代码NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:@"Doctor"];
[fetchRequest setPredicate:[NSPredicate predicateWithFormat:@"id != nil"]];
fetchRequest.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"distance" ascending:YES], [NSSortDescriptor sortDescriptorWithKey:@"lastname" ascending:YES]];
并尝试转换为Swift
var fetchRequest: NSFetchRequest = NSFetchRequest(entityName: "Doctor")
fetchRequest.predicate = NSPredicate(format: "id != nil")
let disctanceSortDescriptor = NSSortDescriptor(key:"distance",ascending: true)
let lastNameSortDescriptor = NSSortDescriptor(key:"lastname",ascending: true)
fetchRequest.sortDescriptors = NSSortDescriptor(key:"distance",ascending: true), NSSortDescriptor(key:"lastname",ascending: true)
如何将Objective-C转换为Swift
fetchRequest.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"distance" ascending:YES], [NSSortDescriptor sortDescriptorWithKey:@"lastname" ascending:YES]];
答案 0 :(得分:0)
我认为你需要的是这个
<a href='http://something.com/Folder/Index?showId=@item.id'>Edit</a>
希望这对你有帮助!