mirror of https://github.com/oxen-io/session-ios
				
				
				
			
			You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			46 lines
		
	
	
		
			922 B
		
	
	
	
		
			Swift
		
	
			
		
		
	
	
			46 lines
		
	
	
		
			922 B
		
	
	
	
		
			Swift
		
	
| import PromiseKit
 | |
| 
 | |
| public extension AnyPromise {
 | |
| 
 | |
|     @objc func retainUntilComplete() {
 | |
|         var retainCycle: AnyPromise? = self
 | |
|         _ = self.ensure {
 | |
|             assert(retainCycle != nil)
 | |
|             retainCycle = nil
 | |
|         }
 | |
|     }
 | |
| }
 | |
| 
 | |
| public extension PMKFinalizer {
 | |
| 
 | |
|     func retainUntilComplete() {
 | |
|         var retainCycle: PMKFinalizer? = self
 | |
|         self.finally {
 | |
|             assert(retainCycle != nil)
 | |
|             retainCycle = nil
 | |
|         }
 | |
|     }
 | |
| }
 | |
| 
 | |
| public extension Promise {
 | |
|     
 | |
|     func retainUntilComplete() {
 | |
|         var retainCycle: Promise<T>? = self
 | |
|         _ = self.ensure {
 | |
|             assert(retainCycle != nil)
 | |
|             retainCycle = nil
 | |
|         }
 | |
|     }
 | |
| }
 | |
| 
 | |
| public extension Guarantee {
 | |
|     
 | |
|     func retainUntilComplete() {
 | |
|         var retainCycle: Guarantee<T>? = self
 | |
|         _ = self.done { _ in
 | |
|             assert(retainCycle != nil)
 | |
|             retainCycle = nil
 | |
|         }
 | |
|     }
 | |
| }
 |