This repository has been archived by the owner on Mar 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
introduced ReachabilityListener as a class to wrap around the callback
- Loading branch information
anho
committed
Oct 5, 2018
1 parent
4bb1a8c
commit 32cc5a5
Showing
8 changed files
with
92 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
ReachabilityUI/ReachabilityUI/Model/ReachabilityListener.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// | ||
// ReachabilityListener.swift | ||
// ReachabilityUI | ||
// | ||
// Created by Andrei Hogea on 05/10/2018. | ||
// Copyright © 2018 Nodes Aps. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
public protocol ReachabilityListenerProtocol { | ||
func listen(_ closure: @escaping Listener) | ||
} | ||
|
||
public final class ReachabilityListener: ReachabilityListenerProtocol { | ||
|
||
private let ReachabilityListenerRepository: ReachabilityListenerRepository | ||
let id: Int | ||
|
||
init(ReachabilityListenerRepository: ReachabilityListenerRepository, id: Int) { | ||
self.ReachabilityListenerRepository = ReachabilityListenerRepository | ||
self.id = id | ||
} | ||
|
||
public func listen(_ closure: @escaping Listener) { | ||
ReachabilityListenerRepository.addListener(closure, id: id) | ||
} | ||
|
||
deinit { | ||
ReachabilityListenerRepository.removeListener(for: id) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
github "nodes-ios/Reachability-UI" "0.1" | ||
github "nodes-ios/Reachability-UI" "0.2.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters