apiFunc(user: User.currentUser, start: 0, limit: Constants.numberOfItemInOnePage,
success: { [weak self] (friends) -> Void in
dispatch_async(dispatch_get_main_queue(), { [weak self] () -> Void in
if let strongSelf = self {
strongSelf.friendList = friends
strongSelf.loading = false
strongSelf.tableView.reloadData()
}
})
}, failure: nil)
error
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
happens when compile the code above, but if I remove the 2nd [weak self], error disappears
apiFunc(user: User.currentUser, start: 0, limit: Constants.numberOfItemInOnePage,
success: { [weak self] (friends) -> Void in
dispatch_async(dispatch_get_main_queue(), { () -> Void in
if let strongSelf = self {
strongSelf.friendList = friends
strongSelf.loading = false
strongSelf.tableView.reloadData()
}
})
}, failure: nil)
I think as there are 2 closures, it should be 2 [weak self], anyone knows why compile error happens