Skip to content

Commit

Permalink
Merge pull request krzysztofzablocki#1 from zenangst/main
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztofzablocki authored Apr 4, 2022
2 parents 35f40d7 + d3476a6 commit be18ea2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 2 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ let package = Package(
name: "Inject",
platforms: [
.macOS(.v10_15),
.iOS(.v13)
.iOS(.v13),
.tvOS(.v13)
],
products: [
.library(
Expand Down
6 changes: 2 additions & 4 deletions Sources/Inject/Inject.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Foundation
import Combine
import SwiftUI

/// Common protocol interface for classes that support observing injection events
/// This is automatically added to all NSObject subclasses like `ViewController`s or `Window`s
Expand Down Expand Up @@ -56,10 +57,7 @@ private var injectionObservationKey = arc4random()
public extension InjectListener where Self: NSObject {
func onInjection(callback: @escaping (Self) -> Void) {
let observation = injectionObserver.objectWillChange.sink(receiveValue: { [weak self] in
guard let self = self else {
return
}

guard let self = self else { return }
callback(self)
})

Expand Down

0 comments on commit be18ea2

Please sign in to comment.