Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
Elixxir dApps SDK Swift
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mobile
iOS
Elixxir dApps SDK Swift
Commits
2fc6d1a4
Commit
2fc6d1a4
authored
2 years ago
by
Dariusz Rybicki
Browse files
Options
Downloads
Patches
Plain Diff
Rename MessageListener to Listener
parent
d47f5f09
No related branches found
No related tags found
2 merge requests
!102
Release 1.0.0
,
!18
Update Bindings
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Sources/ElixxirDAppsSDK/Callbacks/Listener.swift
+51
-0
51 additions, 0 deletions
Sources/ElixxirDAppsSDK/Callbacks/Listener.swift
Sources/ElixxirDAppsSDK/Connection/Functors/ConnectionRegisterListener.swift
+2
-2
2 additions, 2 deletions
...sSDK/Connection/Functors/ConnectionRegisterListener.swift
with
53 additions
and
2 deletions
Sources/ElixxirDAppsSDK/Callbacks/
Message
Listener.swift
→
Sources/ElixxirDAppsSDK/Callbacks/Listener.swift
+
51
−
0
View file @
2fc6d1a4
import
Bindings
import
XCTestDynamicOverlay
public
struct
Message
Listener
{
public
struct
Listener
{
public
init
(
name
:
String
=
"
Message
Listener"
,
name
:
String
=
"Listener"
,
handle
:
@escaping
(
Message
)
->
Void
)
{
self
.
name
=
name
...
...
@@ -14,21 +14,21 @@ public struct MessageListener {
public
var
handle
:
(
Message
)
->
Void
}
extension
Message
Listener
{
public
static
let
unimplemented
=
Message
Listener
(
extension
Listener
{
public
static
let
unimplemented
=
Listener
(
name
:
"unimplemented"
,
handle
:
XCTUnimplemented
(
"
\(
Self
.
self
)
"
)
)
}
extension
Message
Listener
{
extension
Listener
{
func
makeBindingsListener
()
->
BindingsListenerProtocol
{
class
Listener
:
NSObject
,
BindingsListenerProtocol
{
init
(
_
listener
:
Message
Listener
)
{
class
Callback
:
NSObject
,
BindingsListenerProtocol
{
init
(
_
listener
:
Listener
)
{
self
.
listener
=
listener
}
let
listener
:
Message
Listener
let
listener
:
Listener
func
hear
(
_
item
:
Data
?)
{
guard
let
item
=
item
else
{
...
...
@@ -46,54 +46,6 @@ extension MessageListener {
}
}
return
Listener
(
self
)
return
Callback
(
self
)
}
}
//
//public struct MessageListener {
// public var listen: (Int, String, @escaping (Message) -> Void) -> Void
//
// public func callAsFunction(
// messageType: Int,
// listenerName: String = "MessageListener",
// callback: @escaping (Message) -> Void
// ) {
// listen(messageType, listenerName, callback)
// }
//}
//
//extension MessageListener {
// public static func live(
// bindingsConnection: BindingsConnection
// ) -> MessageListener {
// MessageListener.live(
// register: bindingsConnection.registerListener(_:newListener:)
// )
// }
//
// public static func live(
// bindingsAuthenticatedConnection: BindingsAuthenticatedConnection
// ) -> MessageListener {
// MessageListener.live(
// register: bindingsAuthenticatedConnection.registerListener(_:newListener:)
// )
// }
//
// private static func live(
// register: @escaping (Int, BindingsListenerProtocol) -> Void
// ) -> MessageListener {
// MessageListener { messageType, listenerName, callback in
// register(messageType, Listener(listenerName: listenerName, onHear: callback))
// }
// }
//}
//
//
//#if DEBUG
//extension MessageListener {
// public static let failing = MessageListener { _, _, _ in
// fatalError("Not implemented")
// }
//}
//#endif
This diff is collapsed.
Click to expand it.
Sources/ElixxirDAppsSDK/Connection/Functors/ConnectionRegisterListener.swift
+
2
−
2
View file @
2fc6d1a4
...
...
@@ -2,11 +2,11 @@ import Bindings
import
XCTestDynamicOverlay
public
struct
ConnectionRegisterListener
{
public
var
run
:
(
Int
,
Message
Listener
)
throws
->
Void
public
var
run
:
(
Int
,
Listener
)
throws
->
Void
public
func
callAsFunction
(
messageType
:
Int
,
listener
:
Message
Listener
listener
:
Listener
)
throws
{
try
run
(
messageType
,
listener
)
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment