Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Gacui | 2,163 | 6 days ago | 15 | other | C++ | |||||
GPU Accelerated C++ User Interface, with WYSIWYG developing tools, XML supports, built-in data binding and MVVM features. | ||||||||||
Mvvmlight | 1,683 | 6 years ago | 14 | Java | ||||||
A toolkit help to build Android MVVM Application | ||||||||||
Loxodon Framework | 1,495 | 7 | 6 days ago | 6 | July 11, 2022 | 1 | mit | C# | ||
An MVVM & Databinding framework that can use C# and Lua to develop games | ||||||||||
Neutronium | 1,316 | 3 | 8 | 5 months ago | 16 | September 11, 2020 | 92 | mit | C# | |
🚀 Build .NET desktop applications using HTML, CSS and javascript. | ||||||||||
Robobinding | 1,306 | 7 | 2 | 6 years ago | 15 | June 13, 2016 | 35 | other | Java | |
A data-binding Presentation Model(MVVM) framework for the Android platform. | ||||||||||
Mvvm_hacker_news | 887 | 6 years ago | 6 | Java | ||||||
Android MVVM experiment project using the official Data Binding library | ||||||||||
Iossampleapp | 666 | 2 months ago | mit | Swift | ||||||
Sample iOS app demonstrating Coordinators, Dependency Injection, MVVM, Binding | ||||||||||
People Mvvm | 661 | 3 years ago | Java | |||||||
Sample created to practice MVVM and DataBinding in Android Applications. | ||||||||||
Countries | 609 | 5 years ago | 4 | other | Kotlin | |||||
An example Android app using Retrofit, Realm, Parceler, Dagger and the MVVM pattern with the data binding lib. | ||||||||||
Android Mvvm | 437 | 5 years ago | 16 | apache-2.0 | Java | |||||
MVVM on Android using RxJava and Data Binding |
“The central component of MVC, the model, captures the behavior of the application in terms of its problem domain, independent of the user interface.”
(where *user interface* is the View and Controller)
The
ViewModel
captures the behaviors of an user interface in terms of general user interactions, independent of the view itself.
ViewModel
per controller or UIView
subclass:
UIViewController
UITableViewCell
UICollectionViewCell
Views communicate with their ViewModels, which communicate with each other.
If the view’s state is stored in a ViewModel
class, how do we keep the two in
sync?
ViewModel
in sync with its View
Functional reactive programming (FRP) is a programming paradigm for reactive programming (asynchronous dataflow programming) using the building blocks of functional programming (e.g. map, reduce, filter).
SignalProducer
and Signal
next
: The data that the signal carries – can happen many timeserror
: An error occurred – terminatesinterrupted
: The signal was interrupted – terminatescompleted
: Successful completion – terminatesfunc doNetworkStuff() -> SignalProducer<JSON, NoError>
let producer = doNetworkStuff()
producer.startWithNext { json in print(json) }
let text = MutableProperty<String>("Hello, World!")
text.value // => "Hello, World!"
text.producer // => SignalProducer<String, NoError>
text.producer.startWithNext { s in print(s) } // prints "Hello, World!"
text.value = "Yo." // prints "Yo"
SignalProducer
of the values in the propertylet (producer, observer) = SignalProducer<String, NoError>.buffer()
let text = MutableProperty<String>("")
text <~ producer
observer.sendNext("a")
text.value // "a"
observer.sendNext("b")
text.value // "b"
SignalProducer
to a MutableProperty
<~
KVO
!func saveTodoOnServer(todo: Todo) -> SignalProducer<Bool, NSError> {
return SignalProducer(value: true)
}
let createTodo = Action { (t: Todo) -> SignalProducer<Bool, NSError> in
return saveTodoOnServer(t)
}
let todo = Todo()
createTodo.values.observeNext { success in print(success) }
createTodo.apply(todo) // => SignalProducer<Bool, NSError>
createTodo.apply(todo).start() // prints "true"
createTodo.apply(todo).start() // prints "true"
SignalProducer
values
property: A Signal
of the values of the SignalProducer
protocol ViewModelServicesProtocol {
var todo: TodoServiceProtocol { get }
var date: DateServiceProtocol { get }
func push(viewModel: ViewModelProtocol)
func pop(viewModel: ViewModelProtocol)
}
protocol ViewModelProtocol {
var services: ViewModelServicesProtocol { get }
}
func push(viewModel: ViewModelProtocol)
func pop(viewModel: ViewModelProtocol)
push
other ViewModels.protocol TodoServiceProtocol {
func update(todo: Todo) -> SignalProducer<Todo, NoError>
func delete(todo: Todo) -> SignalProducer<Bool, NoError>
func create(note: String, dueDate: NSDate) -> SignalProducer<Todo, NoError>
}
class TodoTableViewModel: ViewModel, CreateTodoViewModelDelegate {
let todos = MutableProperty<[TodoCellViewModel]>([])
let deleteTodo: Action<(todos: [TodoCellViewModel], cell: TodoCellViewModel), NSIndexPath?, NoError>
}
class TodoTableViewController: ReactiveViewController<TodoTableViewModel> {
override func viewDidLoad() {
super.viewDidLoad()
func removeRow(indexPath: NSIndexPath?) {
todoTableView.deleteRowsAtIndexPaths([indexPath!], withRowAnimation: .Left)
}
// Remove a row whenever a Todo is deleted
viewModel.deleteTodo.values
.filter { $0 != nil }
.observeOn(UIScheduler())
.observeNext(removeRow)
}
}
The code: https://github.com/jalehman/todolist-mvvm
Thanks for letting me talk!