Giter Site home page Giter Site logo

AppKit extensions about reactivekit HOT 5 CLOSED

declarativehub avatar declarativehub commented on July 20, 2024
AppKit extensions

from reactivekit.

Comments (5)

tonyarnold avatar tonyarnold commented on July 20, 2024

I've ported across a lot of what's in Bond, here: https://github.com/tonyarnold/ReactiveAppKit

Feel free to grab what you want 👍

from reactivekit.

srdanrasic avatar srdanrasic commented on July 20, 2024

Thanks @tonyarnold. I've been away for past couple of months, but I'm coming back soon and will port that as well as make some tweaks and improvements to the frameworks.

from reactivekit.

tom-ashe avatar tom-ashe commented on July 20, 2024

Nice work, @srdanrasic and @tonyarnold!

I've given this code a go over the weekend and the NSTableView is working well, so far.

I've run into unexpected results with binding a String and an NSTextField, however.

Observations:

  1. I'm able to bind an NSTextField to a String, but not the inverse.
  2. On invoking observe to the String and the NSTextField, the NSTextField only calls the closure on observe, not on subsequent value changes.
  3. The bind of NSTextField to a string does not update the String on change of the NSTextField
  4. The property on the NSControl extension is called "rStringleValue". Is this intentional or a typo for "rStringValue"?

Any thoughts?

Below is the code I'm using in the VoewController after creating a default swift project in xcode.

import Cocoa
import ReactiveKit
import ReactiveAppKit

class ViewController: NSViewController {

    @IBOutlet var testField: NSTextField?
    var testString = Observable<String?>("")
    let disposeBag = DisposeBag()

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        testField?.stringValue = "foo"

        testField?.rStringleValue.bindTo(testString)

// Fails. Cannot invoke 'bindTo' with an argument list of type '(NSTextField?)'
//        testString.bindTo(testField)

        testField?.rStringleValue.observe { value in
            print(value)
        }.disposeIn(self.disposeBag)

        testString.observe { value in
            print(value)
        }.disposeIn(self.disposeBag)

        testField?.stringValue = "bar"

        testString.value = "baz"
    }

    deinit {
        self.disposeBag.dispose()
    }


    override var representedObject: AnyObject? {
        didSet {
        // Update the view, if already loaded.
        }
    }
}

from reactivekit.

catalandres avatar catalandres commented on July 20, 2024

@srdanrasic Instead of duplicating all the amazing job you have already done in Bond, why don't you just add it as a subproject? Easier to maintain, no?

from reactivekit.

srdanrasic avatar srdanrasic commented on July 20, 2024

This is now part of Bond framework.

from reactivekit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.