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 am using Acknowlist with SwiftUI and generate the list from the package, which works great.
However, I need to add items to the list, that are not in the package (e.g. graphics licenses, etc.). But the defined + operator for two AcknowList is not public. Initializing of a AcknowList is also not possible from outside the package and the properties including the acknowledgements on an AcknowList are defined with let and therefor can not be mutated.
This PR fixes the first two things, so you can do stuff like:
let listFromPackage = try! AcknowPackageDecoder().decode(from: packageData)
let customList = AcknowList(headerText: nil, acknowledgements: [
Acknow(title: "Some Graphics", license: "License of the graphics")
], footerText: nil)
let combinedAcknowList = customList + listFromPackage
but not (because the acknowledgments property is a let instead of a var):
let url = Bundle.main.url(forResource: "Package", withExtension: "resolved")!
let data = try! Data(contentsOf: url)
var list = try! AcknowPackageDecoder().decode(from: data)
list.acknowledgments.append(Acknow(title: "Some Graphics", license: "License of the graphics"))
Hello Andreas, and thanks a lot for preparing this pull request!
I agree this would be a useful change. There’s just one aspect I would like to preserve as-is: the properties being constants (let) instead of variables. I think you can still achieve the same outcome, using the public initializer or the + operator. Could you please roll this back before I merge, or let me know if I’m missing something?
I sincerely appreciate your feedback on this. I’ll stick to the current approach for now, but I’ll keep an open mind in case it needs revising. Thank you!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I am using Acknowlist with SwiftUI and generate the list from the package, which works great.
However, I need to add items to the list, that are not in the package (e.g. graphics licenses, etc.). But the defined
+operator for twoAcknowListis not public. Initializing of aAcknowListis also not possible from outside the package and the properties including theacknowledgementson anAcknowListare defined withletand therefor can not be mutated.This PR fixes the first two things, so you can do stuff like:
but not (because the
acknowledgmentsproperty is aletinstead of avar):