vtourraine / AcknowList

Acknowledgements screen displaying a list of licenses, for example from CocoaPods and Swift Package Manager dependencies.
MIT License
798 stars 60 forks source link

Thoughts on handling special licenses #29

Closed kevinvanderlugt closed 7 years ago

kevinvanderlugt commented 7 years ago

Howdy,

Thanks for this super useful tool! I just started using it and it's super helpful. One issue (not with your project) but when using GooglePlacePicker pod and a few other Google pods they actually have this weird license

simulator screen shot jun 29 2017 2 21 44 pm

I was wondering if you had any thoughts on how to best handle this? My thought is to subclass AcknowListViewController and override func commonInit(acknowledgementsPlistPath: String?) { then look specifically for these special license requirements.

Would you be interested in having something that handles these special licenses by letting the AcknowParser take a list of overrides for ["pod name": some closure that returns a string]? Totally fine if you don't want to add that complexity.

Cheers!

vtourraine commented 7 years ago

Hello Kevin, and thanks for your feedback!

I agree that this kind of licenses is problematic, but it seems like there’s no good universal solution.

When I need to edit the licenses, I just update the acknowledgements property on AcknowListViewController before presenting it. No need to subclass. Would that be a reasonable solution, in the context of your project?

klwoon commented 7 years ago

Could you post some example here how to update the acknowledgements property? I tried to modify the text but it won't allowed: Cannot assign to property: 'text' is a 'let' constant.

Thanks.

vtourraine commented 7 years ago

@klwoon Sure. Here’s an example, I manually set the acknowledgements property with hard-coded values:

let viewController = AcknowListViewController()
viewController.acknowledgements = [Acknow(title: "Test 1", text: "ABC"), Acknow(title: "Test 2", text: "DEF")]
navigationController?.pushViewController(viewController, animated: true)

An individual Acknow instance is immutable, this is why you had the error when you tried to edit the text property directly. You need to edit the acknowledgements array instead. Note that you can also use the Swift filter method to keep some values for the original array.

klwoon commented 7 years ago

Thanks for the example!