I discovered a problem when you combine Cocoapods plist with additional entries.
let viewController = AcknowListViewController(fileNamed: "file")
// Add a special entry
let someLicenseThatsNotInCocoapods = Acknow(title: "Foo", text: "baz")
vc.acknowledgements.append(someLicenseThatsNotInCocoapods)
navigationController.pushViewController(viewController, animated: true)
This does not work out so great, as Foo will always be appended to the end of the list, and you expect them to be sorted. I use this as workaround:
let viewController = AcknowListViewController(fileNamed: "file")
// Add a special entry
let someLicenseThatsNotInCocoapods = Acknow(title: "Foo", text: "baz")
vc.acknowledgements.append(someLicenseThatsNotInCocoapods)
// Sort entries (stolen from load() )
vc.acknowledgements = vc.acknowledgements.sorted(by: {
(ack1: Acknow, ack2: Acknow) -> Bool in
let result = ack1.title.compare(ack2.title, options: [], range: nil, locale: Locale.current)
return (result == ComparisonResult.orderedAscending)
})
navigationController.pushViewController(viewController, animated: true)
It could be solved in a number of ways, perhaps more initialisers with customAcknowledgements: [Acknow] as argument, or just sort the entries in didSet of AcknowListViewController.acknowledgements.
I discovered a problem when you combine Cocoapods plist with additional entries.
This does not work out so great, as
Foowill always be appended to the end of the list, and you expect them to be sorted. I use this as workaround:It could be solved in a number of ways, perhaps more initialisers with
customAcknowledgements: [Acknow]as argument, or just sort the entries indidSetofAcknowListViewController.acknowledgements.