change property timeLabel from strong to weak to avoid reatin cycle. #101
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 used this amazing label for my project, it's perfect for my requirements (😄 thanks, bro.) , but I found that the timeLabel property might have retain cycle issue.
when no specific UILabel object was passed into this object, it will make the timeLabel pointer point to itself ( which is strong assignment), cause the retain cycle.
I tested on my device and that is the case.
I make a demo view controller and add this label as a subview of it.
![CleanShot 2023-05-15 at 23 08 53@2x](https://private-user-images.githubusercontent.com/39005916/238396257-f6059514-5f46-4d44-9ee2-38331c884b2c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1Nzg3MzAsIm5iZiI6MTczOTU3ODQzMCwicGF0aCI6Ii8zOTAwNTkxNi8yMzgzOTYyNTctZjYwNTk1MTQtNWY0Ni00ZDQ0LTllZTItMzgzMzFjODg0YjJjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE1VDAwMTM1MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTAwMzI5NDI1NmUyZjk5OTEzNzEyYTg5MTQwM2U3NTViMjU4ZmQwYzRmZTY4NzNhY2Y5Y2QzYzNmOTgxYjZmNzYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.MAiPSOhUopTljZ8bish3ju8QFwxjl3k5YFyVhbH3m6U)
when I quit the demo view controller. The object still exist on mem graph, which means mem leak (caused by the ivar: _timeLabel)
if I make it weak property, it will dealloc properly.
![CleanShot 2023-05-15 at 23 10 54@2x](https://private-user-images.githubusercontent.com/39005916/238396516-3a6409eb-d378-4767-9568-2527e4285898.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1Nzg3MzAsIm5iZiI6MTczOTU3ODQzMCwicGF0aCI6Ii8zOTAwNTkxNi8yMzgzOTY1MTYtM2E2NDA5ZWItZDM3OC00NzY3LTk1NjgtMjUyN2U0Mjg1ODk4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE1VDAwMTM1MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTMwOGMxNjIzNDIyOTQzMzY3MjQ5YjcwYWRkMWY5MzZjODdlNTczZDE5NjlkMjBjMzg0ZWEzMjdlOTU1NjViNGImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.u9pYPgA-OsRXITsV9JOJJgO-MzM3iq27EFnVIrYQiU4)
(I re-opened this pr, because I forgot to create a new branch lol.)