Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

README.md

WeakRef: A Swift type-safe alternative to weak properties

WeakRef is a type-safe alternative to weak properties that maintains a clean cross-boundary separation of concerns.

final class WeakRef<T: AnyObject> {
	weak var object: T?
	
	init(_ object: T) {
		self.object = object
	}
}

Usage example:

let vc = WeatherViewController()
let presenter = WeatherPresenter(view: WeakRef(vc))
vc.presenter = presenter

Learn more at: https://www.essentialdeveloper.com/articles/clean-ios-architecture-pt-4-clean-memory-management-in-swift-with-weakref

About

`WeakRef` is a type-safe alternative to `weak` properties that maintains a clean cross-boundary separation of concerns.

Resources

License

Releases

No releases published

Packages

No packages published

Languages

You can’t perform that action at this time.