You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
I understand your point, but maybe if someone wants to customize the array of acknowledgements, then they should be responsible for sorting them too? To put it differently: what if someone wants a different order?
Like you said, it could be solved in a number of ways, but I’m not sure which one would be the most appropriate (not adding complexity, but keeping things easy-to-use). Would love more feedback on this.
I discovered a problem when you combine Cocoapods plist with additional entries.
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:It could be solved in a number of ways, perhaps more initialisers with
customAcknowledgements: [Acknow]
as argument, or just sort the entries indidSet
ofAcknowListViewController.acknowledgements
.The text was updated successfully, but these errors were encountered: