profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/darrenclark/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Darren Clark darrenclark theScore (@scoremedia) Toronto, Ontario, Canada https://darrenclark.ca

darrenclark/absinthe 0

The GraphQL toolkit for Elixir

darrenclark/absinthe_apollo_sockets 0

Use the Apollo Websocket protocol to drive Absinthe GraphQL functionality

darrenclark/adjust_ios_sdk 0

This is the iOS SDK of

darrenclark/apollo-tooling 0

✏️ Tooling for development and production Apollo workflows

darrenclark/blog 0

Personal website / blog

darrenclark/broadway 0

Concurrent and multi-stage data ingestion and data processing with Elixir

darrenclark/broadway_cloud_pub_sub 0

A Broadway producer for Google Cloud Pub/Sub

darrenclark/Chip8C 0

A Super Chip 8 emulator written in C

starteddarrenclark/dotfiles

started time in 9 hours

release scoremedia/Fisticuffs

0.0.14

released time in 2 months

created tagscoremedia/Fisticuffs

tag0.0.14

Fisticuffs is a data binding framework for Swift, inspired by Knockout.

created time in 2 months

delete tag scoremedia/Fisticuffs

delete tag : 0.0.14

delete time in 2 months

delete branch scoremedia/Fisticuffs

delete branch : bump-0.0.14

delete time in 2 months

push eventscoremedia/Fisticuffs

Eugene Kwong

commit sha 59b213f7c0b5b473d7e3e8e393db30ee97fc75d9

Bump podspec version to 0.0.14

view details

Eugene Kwong

commit sha ac5f2a009494ff2631e691eb01945071827fef3d

Merge pull request #30 from scoremedia/bump-0.0.14 Bump podspec version to 0.0.14

view details

push time in 2 months

PR opened scoremedia/Fisticuffs

Bump podspec version to 0.0.14
+1 -1

0 comment

1 changed file

pr created time in 2 months

create barnchscoremedia/Fisticuffs

branch : bump-0.0.14

created branch time in 2 months

release scoremedia/Fisticuffs

0.0.14

released time in 2 months

created tagscoremedia/Fisticuffs

tag0.0.14

Fisticuffs is a data binding framework for Swift, inspired by Knockout.

created time in 2 months

delete branch scoremedia/Fisticuffs

delete branch : feature/scheduler

delete time in 2 months

push eventscoremedia/Fisticuffs

Eugene Kwong

commit sha 0584b67ba446edbb543dacd84abaacb8994a2d4a

Add Scheduler option

view details

Eugene Kwong

commit sha b5eca193b49a4b7b28d4197f8b6aea85be30da4b

Add Documentation and Tests

view details

Eugene Kwong

commit sha 1ec9327e276b058d8d2b9b98d5063f4002f6b12a

Optimization

view details

Eugene Kwong

commit sha 7dbe7ea3897fc3ac01a5ceb10d1d00162fb61ca5

Add MainThreadScheduler for bindings

view details

Eugene Kwong

commit sha e001634f890132cc82cc3a625d05e5bf771b4293

Add tests for bindings. Updated documentation

view details

Eugene Kwong

commit sha d0c94fe4de3fdba1d157c45529569a324d6c55a3

Allow Scheduler to be passed for bindings. Add documentation

view details

Eugene Kwong

commit sha 9c45ff91e3ea1e85120282a8c050a0efa9939765

Rearrange arguments

view details

Eugene Kwong

commit sha 273b15d9b60af97d23e386e1ce25c103526b4a00

Merge pull request #29 from scoremedia/feature/scheduler Add Scheduler to subscriptions

view details

push time in 2 months

PR merged scoremedia/Fisticuffs

Reviewers
Add Scheduler to subscriptions

Allows more granular control of where the callback is performed for subscribers.

The idea is based off Combine and RxSwift Schedulers, which dictates the where and when work will be performed. At the moment this implementation is pretty basic as it only contains the where, but this serves as a building block for further expansion.

Adds default implementation to DispatchQueue, RunLoop, and OperationQueue so those can be passed in directly to SubscriptionOptions. If nothing is passed it creates a generic DefaultScheduler which basically represents the current running thread, i.e. the existing behaviour.

To Do

  • [x] Documentation
  • [x] Unit tests
+614 -42

3 comments

17 changed files

ketenshi

pr closed time in 2 months

Pull request review commentscoremedia/Fisticuffs

Add Scheduler to subscriptions

 extension BidirectionalBindableProperty { //MARK: - Binding public extension BidirectionalBindableProperty {     //MARK: Two way binding-    func bind(_ observable: Observable<ValueType>) {+    /// Bind property to observable+    ///+    /// - Parameters:+    ///   - observable: The `Observable`+    ///   - receiveOn: The `Scheduler` for the call back. Defaults to `MainThreadScheduler`+    func bind(_ observable: Observable<ValueType>, receiveOn scheduler: Scheduler = MainThreadScheduler()) {         bind(observable, DefaultBindingHandler())     } -    func bind<Data>(_ observable: Observable<Data>, _ bindingHandler: BindingHandler<Control, Data, ValueType>) {+    /// Bind property to subscribable+    ///+    /// - Parameters:+    ///   - observable: The `Observable`+    ///   - bindingHandler: The custom `BindingHandler`+    ///   - receiveOn: The `Scheduler` for the call back. Defaults to `MainThreadScheduler`+    func bind<Data>(+        _ observable: Observable<Data>,+        _ bindingHandler: BindingHandler<Control, Data, ValueType>,+        receiveOn scheduler: Scheduler = MainThreadScheduler()

Should be good now

ketenshi

comment created time in 2 months

push eventscoremedia/Fisticuffs

Eugene Kwong

commit sha 9c45ff91e3ea1e85120282a8c050a0efa9939765

Rearrange arguments

view details

push time in 2 months

Pull request review commentscoremedia/Fisticuffs

Add Scheduler to subscriptions

 extension BidirectionalBindableProperty { //MARK: - Binding public extension BidirectionalBindableProperty {     //MARK: Two way binding-    func bind(_ observable: Observable<ValueType>) {+    /// Bind property to observable+    ///+    /// - Parameters:+    ///   - observable: The `Observable`+    ///   - receiveOn: The `Scheduler` for the call back. Defaults to `MainThreadScheduler`+    func bind(_ observable: Observable<ValueType>, receiveOn scheduler: Scheduler = MainThreadScheduler()) {         bind(observable, DefaultBindingHandler())     } -    func bind<Data>(_ observable: Observable<Data>, _ bindingHandler: BindingHandler<Control, Data, ValueType>) {+    /// Bind property to subscribable+    ///+    /// - Parameters:+    ///   - observable: The `Observable`+    ///   - bindingHandler: The custom `BindingHandler`+    ///   - receiveOn: The `Scheduler` for the call back. Defaults to `MainThreadScheduler`+    func bind<Data>(+        _ observable: Observable<Data>,+        _ bindingHandler: BindingHandler<Control, Data, ValueType>,+        receiveOn scheduler: Scheduler = MainThreadScheduler()

Ah good catch

ketenshi

comment created time in 2 months

Pull request review commentscoremedia/Fisticuffs

Add Scheduler to subscriptions

 extension BidirectionalBindableProperty { //MARK: - Binding public extension BidirectionalBindableProperty {     //MARK: Two way binding-    func bind(_ observable: Observable<ValueType>) {+    /// Bind property to observable+    ///+    /// - Parameters:+    ///   - observable: The `Observable`+    ///   - receiveOn: The `Scheduler` for the call back. Defaults to `MainThreadScheduler`+    func bind(_ observable: Observable<ValueType>, receiveOn scheduler: Scheduler = MainThreadScheduler()) {         bind(observable, DefaultBindingHandler())     } -    func bind<Data>(_ observable: Observable<Data>, _ bindingHandler: BindingHandler<Control, Data, ValueType>) {+    /// Bind property to subscribable+    ///+    /// - Parameters:+    ///   - observable: The `Observable`+    ///   - bindingHandler: The custom `BindingHandler`+    ///   - receiveOn: The `Scheduler` for the call back. Defaults to `MainThreadScheduler`+    func bind<Data>(+        _ observable: Observable<Data>,+        _ bindingHandler: BindingHandler<Control, Data, ValueType>,+        receiveOn scheduler: Scheduler = MainThreadScheduler()

We need to update this too

ketenshi

comment created time in 2 months

Pull request review commentscoremedia/Fisticuffs

Add Scheduler to subscriptions

 extension BidirectionalBindableProperty { //MARK: - Binding public extension BidirectionalBindableProperty {     //MARK: Two way binding-    func bind(_ observable: Observable<ValueType>) {+    /// Bind property to observable+    ///+    /// - Parameters:+    ///   - observable: The `Observable`+    ///   - receiveOn: The `Scheduler` for the call back. Defaults to `MainThreadScheduler`+    func bind(_ observable: Observable<ValueType>, receiveOn scheduler: Scheduler = MainThreadScheduler()) {         bind(observable, DefaultBindingHandler())     } -    func bind<Data>(_ observable: Observable<Data>, _ bindingHandler: BindingHandler<Control, Data, ValueType>) {+    /// Bind property to subscribable+    ///+    /// - Parameters:+    ///   - observable: The `Observable`+    ///   - bindingHandler: The custom `BindingHandler`+    ///   - receiveOn: The `Scheduler` for the call back. Defaults to `MainThreadScheduler`+    func bind<Data>(+        _ observable: Observable<Data>,+        _ bindingHandler: BindingHandler<Control, Data, ValueType>,+        receiveOn scheduler: Scheduler = MainThreadScheduler()

Updated. The bind(_: receiveOn: _:) still feels a bit awkward to me but I think it's a better change

ketenshi

comment created time in 2 months

push eventscoremedia/Fisticuffs

Eugene Kwong

commit sha d88dcff444f4c9cd4b5fc13dd75fb882e3cbfb4f

Rearrange arguments

view details

push time in 2 months

push eventscoremedia/Fisticuffs

Eugene Kwong

commit sha 03371b9cd3cbe4c530f18090958bd541f4ce4571

Rearranged arguments

view details

push time in 2 months

Pull request review commentscoremedia/Fisticuffs

Add Scheduler to subscriptions

 extension BidirectionalBindableProperty { //MARK: - Binding public extension BidirectionalBindableProperty {     //MARK: Two way binding-    func bind(_ observable: Observable<ValueType>) {+    /// Bind property to observable+    ///+    /// - Parameters:+    ///   - observable: The `Observable`+    ///   - receiveOn: The `Scheduler` for the call back. Defaults to `MainThreadScheduler`+    func bind(_ observable: Observable<ValueType>, receiveOn scheduler: Scheduler = MainThreadScheduler()) {         bind(observable, DefaultBindingHandler())     } -    func bind<Data>(_ observable: Observable<Data>, _ bindingHandler: BindingHandler<Control, Data, ValueType>) {+    /// Bind property to subscribable+    ///+    /// - Parameters:+    ///   - observable: The `Observable`+    ///   - bindingHandler: The custom `BindingHandler`+    ///   - receiveOn: The `Scheduler` for the call back. Defaults to `MainThreadScheduler`+    func bind<Data>(+        _ observable: Observable<Data>,+        _ bindingHandler: BindingHandler<Control, Data, ValueType>,+        receiveOn scheduler: Scheduler = MainThreadScheduler()

@ketenshi I agree, it's a breaking change but should be easy to fix.

ketenshi

comment created time in 2 months

Pull request review commentscoremedia/Fisticuffs

Add Scheduler to subscriptions

 extension BidirectionalBindableProperty { //MARK: - Binding public extension BidirectionalBindableProperty {     //MARK: Two way binding-    func bind(_ observable: Observable<ValueType>) {+    /// Bind property to observable+    ///+    /// - Parameters:+    ///   - observable: The `Observable`+    ///   - receiveOn: The `Scheduler` for the call back. Defaults to `MainThreadScheduler`+    func bind(_ observable: Observable<ValueType>, receiveOn scheduler: Scheduler = MainThreadScheduler()) {         bind(observable, DefaultBindingHandler())     } -    func bind<Data>(_ observable: Observable<Data>, _ bindingHandler: BindingHandler<Control, Data, ValueType>) {+    /// Bind property to subscribable+    ///+    /// - Parameters:+    ///   - observable: The `Observable`+    ///   - bindingHandler: The custom `BindingHandler`+    ///   - receiveOn: The `Scheduler` for the call back. Defaults to `MainThreadScheduler`+    func bind<Data>(+        _ observable: Observable<Data>,+        _ bindingHandler: BindingHandler<Control, Data, ValueType>,+        receiveOn scheduler: Scheduler = MainThreadScheduler()

I agree that receiveOn looks cleaner or at least it's more obvious when all properties appear before a closure.

ketenshi

comment created time in 2 months

Pull request review commentscoremedia/Fisticuffs

Add Scheduler to subscriptions

 extension BidirectionalBindableProperty { //MARK: - Binding public extension BidirectionalBindableProperty {     //MARK: Two way binding-    func bind(_ observable: Observable<ValueType>) {+    /// Bind property to observable+    ///+    /// - Parameters:+    ///   - observable: The `Observable`+    ///   - receiveOn: The `Scheduler` for the call back. Defaults to `MainThreadScheduler`+    func bind(_ observable: Observable<ValueType>, receiveOn scheduler: Scheduler = MainThreadScheduler()) {         bind(observable, DefaultBindingHandler())     } -    func bind<Data>(_ observable: Observable<Data>, _ bindingHandler: BindingHandler<Control, Data, ValueType>) {+    /// Bind property to subscribable+    ///+    /// - Parameters:+    ///   - observable: The `Observable`+    ///   - bindingHandler: The custom `BindingHandler`+    ///   - receiveOn: The `Scheduler` for the call back. Defaults to `MainThreadScheduler`+    func bind<Data>(+        _ observable: Observable<Data>,+        _ bindingHandler: BindingHandler<Control, Data, ValueType>,+        receiveOn scheduler: Scheduler = MainThreadScheduler()

Yea I agree.

@francocarbonaro what do you think? Should we go with this?

ketenshi

comment created time in 2 months

Pull request review commentscoremedia/Fisticuffs

Add Scheduler to subscriptions

 extension BidirectionalBindableProperty { //MARK: - Binding public extension BidirectionalBindableProperty {     //MARK: Two way binding-    func bind(_ observable: Observable<ValueType>) {+    /// Bind property to observable+    ///+    /// - Parameters:+    ///   - observable: The `Observable`+    ///   - receiveOn: The `Scheduler` for the call back. Defaults to `MainThreadScheduler`+    func bind(_ observable: Observable<ValueType>, receiveOn scheduler: Scheduler = MainThreadScheduler()) {         bind(observable, DefaultBindingHandler())     } -    func bind<Data>(_ observable: Observable<Data>, _ bindingHandler: BindingHandler<Control, Data, ValueType>) {+    /// Bind property to subscribable+    ///+    /// - Parameters:+    ///   - observable: The `Observable`+    ///   - bindingHandler: The custom `BindingHandler`+    ///   - receiveOn: The `Scheduler` for the call back. Defaults to `MainThreadScheduler`+    func bind<Data>(+        _ observable: Observable<Data>,+        _ bindingHandler: BindingHandler<Control, Data, ValueType>,+        receiveOn scheduler: Scheduler = MainThreadScheduler()

It would become a breaking change for sure if we add the argument names. But to me it doesn't make sense to have receiveOn: at the end because.

label.b_text.bind(someBindable, BindingHandlers.computed { x -> y in 
    // some long code
    return instanceOfY
}, receiveOn: SomeScheduler())
ketenshi

comment created time in 2 months

Pull request review commentscoremedia/Fisticuffs

Add Scheduler to subscriptions

 extension BidirectionalBindableProperty { //MARK: - Binding public extension BidirectionalBindableProperty {     //MARK: Two way binding-    func bind(_ observable: Observable<ValueType>) {+    /// Bind property to observable+    ///+    /// - Parameters:+    ///   - observable: The `Observable`+    ///   - receiveOn: The `Scheduler` for the call back. Defaults to `MainThreadScheduler`+    func bind(_ observable: Observable<ValueType>, receiveOn scheduler: Scheduler = MainThreadScheduler()) {         bind(observable, DefaultBindingHandler())     } -    func bind<Data>(_ observable: Observable<Data>, _ bindingHandler: BindingHandler<Control, Data, ValueType>) {+    /// Bind property to subscribable+    ///+    /// - Parameters:+    ///   - observable: The `Observable`+    ///   - bindingHandler: The custom `BindingHandler`+    ///   - receiveOn: The `Scheduler` for the call back. Defaults to `MainThreadScheduler`+    func bind<Data>(+        _ observable: Observable<Data>,+        _ bindingHandler: BindingHandler<Control, Data, ValueType>,+        receiveOn scheduler: Scheduler = MainThreadScheduler()

I initially had that but this could be a breaking change. Also it won't make sense to have a bind(_: , receiveOn: ..., _:) pattern.

I can change if it we're good with that

ketenshi

comment created time in 2 months

Pull request review commentscoremedia/Fisticuffs

Add Scheduler to subscriptions

 extension BidirectionalBindableProperty { //MARK: - Binding public extension BidirectionalBindableProperty {     //MARK: Two way binding-    func bind(_ observable: Observable<ValueType>) {+    /// Bind property to observable+    ///+    /// - Parameters:+    ///   - observable: The `Observable`+    ///   - receiveOn: The `Scheduler` for the call back. Defaults to `MainThreadScheduler`+    func bind(_ observable: Observable<ValueType>, receiveOn scheduler: Scheduler = MainThreadScheduler()) {         bind(observable, DefaultBindingHandler())     } -    func bind<Data>(_ observable: Observable<Data>, _ bindingHandler: BindingHandler<Control, Data, ValueType>) {+    /// Bind property to subscribable+    ///+    /// - Parameters:+    ///   - observable: The `Observable`+    ///   - bindingHandler: The custom `BindingHandler`+    ///   - receiveOn: The `Scheduler` for the call back. Defaults to `MainThreadScheduler`+    func bind<Data>(+        _ observable: Observable<Data>,+        _ bindingHandler: BindingHandler<Control, Data, ValueType>,+        receiveOn scheduler: Scheduler = MainThreadScheduler()

I think receiveOn should come before the BindingHandler argument. Most of the binding handlers use closures and it would be cleaner.

ketenshi

comment created time in 2 months

Pull request review commentscoremedia/Fisticuffs

Add Scheduler to subscriptions

 public extension BidirectionalBindableProperty {          //MARK: One way binding -    func bind(_ subscribable: Subscribable<ValueType>) {+    /// Bind property to subscribable+    ///+    /// - Parameters:+    ///   - subscribable: The `Subscribable`+    ///   - receiveOn: The `Scheduler` for the call back. Defaults to `MainThreadScheduler`+    func bind(_ subscribable: Subscribable<ValueType>, receiveOn scheduler: Scheduler = MainThreadScheduler()) {         bind(subscribable, DefaultBindingHandler())     } -    func bind<Data>(_ subscribable: Subscribable<Data>, _ bindingHandler: BindingHandler<Control, Data, ValueType>) {+    /// Bind property to subscribable+    ///+    /// - Parameters:+    ///   - subscribable: The `Subscribable`+    ///   - bindingHandler: The custom `BindingHandler`+    ///   - receiveOn: The `Scheduler` for the call back. Defaults to `MainThreadScheduler`+    func bind<Data>(+        _ subscribable: Subscribable<Data>,+        _ bindingHandler: BindingHandler<Control, Data, ValueType>,+        receiveOn scheduler: Scheduler = MainThreadScheduler()

@tahirmt added! I'm not sure if we want to keep the argument name hidden or not

ketenshi

comment created time in 2 months

push eventscoremedia/Fisticuffs

Eugene Kwong

commit sha d0c94fe4de3fdba1d157c45529569a324d6c55a3

Allow Scheduler to be passed for bindings. Add documentation

view details

push time in 2 months

Pull request review commentscoremedia/Fisticuffs

Add Scheduler to subscriptions

 open class ComputedBindingHandler<Control: AnyObject, InDataValue, OutDataValue,         subscription?.dispose()          // so we get oldValue/newValue information, we'll notifyOnSubscription = false, then set it to the new value after-        let opts = SubscriptionOptions(notifyOnSubscription: false, when: .afterChange)+        let opts = SubscriptionOptions(notifyOnSubscription: false, when: .afterChange, receiveOn: MainThreadScheduler())

Sure, I'll add it

ketenshi

comment created time in 2 months