blendle / hanson Goto Github PK
View Code? Open in Web Editor NEWLightweight observations and bindings in Swift
License: ISC License
Lightweight observations and bindings in Swift
License: ISC License
Hello, I got an issue that the view controller cannot release when observing a notification like this.
let observable = NotificationCenter.default.observable(for: Notification.Name.UIApplicationDidEnterBackground)
observe(observable) { notification in
print("Application did enter background")
}
How to fix it ? Thanks.
How would you go about observing an array using Hanson?
I am not quite sure how to approach this and think my understanding of Hanson is not yet up-to-speed. I have a complex object from another repo. It is very deep and async-oriented. I want to track at least one property from it, and prefer not to tap into their repo to make changes. Without those changes, is something like this possible?
I want to track the duration property of the youtube API return values from player within youtubeKit, if that helps. And i understand if this is too complex to ask! thx...
Hello, Thank you very much for your library !! I have a problem: when I input text to a UITextFiled (from xib), how do I listen for changes in text ?
Update for Swift 4 please
Hi. Thank you for your work. I've been looking for a library just like yours. It's great for implementing MVVM without having to add RxSwift and so.
I'm getting an error when I try to use the bind function. For instance, if I write:
bind(wsSuccess, to: model.wsFBSuccess) //both properties are Observable(false)
I get a Xcode error saying "Missing argument for parameter #3 in call". I don't know if you have changed the function signature from the one appearing in the readme but autocomplete is only offering me: bind(Int32, UnsafePointer!, socklen_t) which seems unrelated to your library.
What am I doing wrong?
The current one still doesn't support observing NotificationCenter notifications.
import UIKit
import Hanson
final class RootCoordinator {
static func presentTodoLists(list:[TodoModel]) -> UINavigationController {
// Adding observer listening to model change
observe(todosObservable) { event in
}
}
}
Hello @utemissov ,
Is there anyway that I can observe a value inside a kind of non-ui class ?
Let's say I'd like to observe a property of type UIImage. Is there a way of make it nil by default?
Something like:
let observableImage : UIImage? = Observable(nil)
For example:
observe(observable) { (e) in
cb();
}
cb();
But with reactive property I can code like this:
observable.subscribe { (e) in
cb();
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.