onmyway133 / DeepDiff

🦀Amazingly incredible extraordinary lightning fast diffing in Swift
https://onmyway133.com/apps/
Other
2.05k stars 145 forks source link

lifetime of Heckel? #62

Closed AndrewSB closed 3 years ago

AndrewSB commented 3 years ago

hey! I was surprised to see that Heckel didn't have static functions, and instead expects diffs to be carried out on an instance. i noticed that in my usage of the class, i have

    public func update(data: [ListSection], animating: Bool = false, completion: (() -> Void)? = nil) {
        if self.data.isNotEmpty {
            let diff = HeckelDiffingAlgorithm().diff(old: self.data, new: data)

where I create a new instance each time. Is that required? or can I create one instance and reuse it each time my data changes?

github-actions[bot] commented 3 years ago

Message that will be displayed on users' first issue

onmyway133 commented 3 years ago

@AndrewSB Hi, you can just create 1 instance and use it, everything is immutable

AndrewSB commented 3 years ago

awesome, thanks for letting me know!