Skip to main content

Questions tagged [viewmodel]

A view model or viewpoints framework is a framework which defines a coherent set of views to be used in the construction of an architecture. A view is a representation of a whole system from the perspective of a related set of concerns.

viewmodel
Filter by
Sorted by
Tagged with
0 votes
1 answer
78 views

Relvant code in ViewModel: val allFoods: LiveData<List<Food>> = repository.allFoods.asLiveData() and MainActivity: ...
user avatar
Best practices
4 votes
5 replies
145 views

As per MVVM architecture, I have to use a view model to separate data layer from UI. Can I instead use a Bloc for this purpose? What are the criteria to use one versus the other? Could you please ...
Alex20280's user avatar
  • 385
Best practices
0 votes
2 replies
61 views

I am building a Jetpack Compose app that uses a Scaffold with a persistent bottom sheet. The main content of the Scaffold show ...
Pawandeep Singh's user avatar
Best practices
0 votes
3 replies
66 views

I come from a MVVM in WPF background moving towards ASP.NET MVC. I have a model that is composed of another model called Message, like so: ...
92carmnad's user avatar
  • 172
0 votes
1 answer
104 views

Should I always initialize a viewmodel in the Activity, before onCreate() even, if it is needed later in the flow? I do not know and am concerned if initialization of all the viewmodels right at the ...
Sayan Basak's user avatar
1 vote
1 answer
96 views

I have a data stream coming from the server. The server does not provide any information about when the next piece of data will arrive. I have a Flow in my ...
Vivek Modi's user avatar
  • 7,939
0 votes
1 answer
53 views

To process the live data for signals, I defined following class SignalsViewModel and when I call the updateSignals function, it get stuck and doesn't run the next command. I create the ...
ShineStar's user avatar
1 vote
1 answer
207 views

I’m working on Android and I have some doubts about how to properly manage ViewModels depending on the type of UI I’m using (XML with Activities/Fragments vs Jetpack Compose). Currently, my main ...
Cristian Alexis Torres Zavala's user avatar
-6 votes
1 answer
138 views

I'm getting an Xcode error: Cannot find $loginVM in scope. I here's the simplified viewModel ...
jonathan3087's user avatar
1 vote
1 answer
148 views

I’m trying to bind the SelectedItem of a WPF TreeView to a property in my MainViewModel in a pure MVVM setup (no code-behind). Since TreeView.SelectedItem is not a dependency property, I created an ...
6EQUJ5HD209458b's user avatar
1 vote
1 answer
75 views

I have a composable which uses Canvas to draw tasks on a clock-like dial. The tasks are read from a ViewModel state, which in turn loads them from a database. The list of tasks varies depending on the ...
Joyce Opio's user avatar
0 votes
1 answer
58 views

I'm using Navigation Component + Hilt DI. I have a Navigation Destination Fragment which hosts a viewpager with 2 fixed fragments. What is the right way to Instantiate the ViewModels within those ...
rdias002's user avatar
  • 234
0 votes
1 answer
110 views

How do I access the button within a collection view to stop and start a timer on it? The sender is a UserItem but I want to change the button within the same collection view. XAML Code (Collection ...
Aeneas's user avatar
  • 280
0 votes
0 answers
92 views

I’m building a Jetpack Compose screen using an MVI pattern (ViewState / ViewEvent / ViewEffect) and Hilt for DI. I have a modal dialog with an input field for a name. The dialog’s composable looks ...
Saif M's user avatar
  • 586
1 vote
1 answer
75 views

In a GET action method, based in some condition, I need to either return the view, or redirect to another action method that receives a view model via POST. This second action method view is strongly ...
patsy2k's user avatar
  • 751
0 votes
1 answer
51 views

I create a class to draw random elements in a fragment, I need pass a list of elements already store in ROOM database with a Dao and Repository class. ViewModel has a simple function to get all data ...
Delek's user avatar
  • 53
0 votes
0 answers
103 views

I have an app using SceneKit in a SwiftUI framework, and I am trying to properly organise my views by defining a separate view for the interface panel as an ZStack overlay. I have moved the buttons (...
user23510612's user avatar
1 vote
1 answer
227 views

I am doing a JetPack Compose course and I am trying to run an example project showcasing use of ViewModel together with Hilt. ...
Cristi's user avatar
  • 818
0 votes
1 answer
75 views

I'm trying to run the example program at https://developer.android.com/kotlin/coroutines#examples-overview in Android Studio Iguana: ...
doru001's user avatar
5 votes
1 answer
252 views

I have a ViewModel that exposes a StateFlow representing the UI state of a book list: ...
Vivek Modi's user avatar
  • 7,939
3 votes
0 answers
336 views

State management in React Native is a well-debated topic, with Redux often being the default choice. However, for developers coming from native mobile development (Kotlin/Swift), Redux can feel ...
Nathan Fallet's user avatar
0 votes
0 answers
81 views

I want to write some UI tests for a Composable screen. I constantly facing the same error again and again. The viewmodel cannot be mocked, even though I have declared the viewmodel class as open. here ...
Nontas Papadopoulos's user avatar
1 vote
1 answer
110 views

Hello I am receiving the error in the title based off the following code: ...
Gil Ong's user avatar
  • 99
1 vote
0 answers
70 views

I want to display a community toolkit popup from a view model. The type of popup I want is a message box where I can pass a string variable that is the message I want displayed. I followed this Learn ...
Bob Gatto's user avatar
  • 178
0 votes
0 answers
103 views

I would like to create a WPF class library based on a TreeView to visualize JSON strings. I define a JsonProperty ...
Ludovic Wagner's user avatar
0 votes
1 answer
66 views

TextField always get empty when I try to write in it. My ViewModel: ...
Ajay Jaiswar's user avatar
0 votes
1 answer
112 views

I followed the steps from the accepted answer from this link.I did my "own implementation", but the command doesn't raise. Also, I did the same as the post said, but it didn't work. Here is ...
L_J's user avatar
  • 1
1 vote
0 answers
156 views

As the title suggests, I am trying to determine the best approach for implementing a shared ViewModel in a multimodule project. Here is the approach I currently use:...
leonel Z's user avatar
1 vote
1 answer
150 views

I have a data class in my models library ...
Ippokratis Karakotsoglou's user avatar
1 vote
0 answers
93 views

I set up latest Android studio and all is up to date. I want to add viewModel to the dependencies of the build gradle. All is now in this Version. ...
JoergSH's user avatar
  • 11
0 votes
2 answers
141 views

I am developing an application which needs a stopwatch. And I want to show the elapsed time using a textblock. My problem is, that the view is not updating, but I can use ICommands. Here I assign the <...
Barta's user avatar
  • 139
-1 votes
1 answer
72 views

I am developing a WPF app for my final university project (thesis). One of the goals is to be able to dynamically change the language of the UI. I suppose that it is not a very good idea to do it the ...
Denis Ivanov's user avatar
0 votes
1 answer
38 views

I have a BottomSheetDialogFragment containing a RecyclerView in my Android app. The data for the ...
Ghazanfar Ateeb's user avatar
0 votes
1 answer
50 views

My application is going to get a new string from the ViewModel every few hours and show it to the user as a notification text. The problem is that I don't know how to get the string from the ViewModel ...
developer_petit's user avatar
1 vote
0 answers
265 views

I have this compose code who works perfectly: ...
Kevin ABRIOUX's user avatar
1 vote
2 answers
170 views

I have two ViewModels that contain the same function. The function calls an interface/repository to retrieve data from a database, and the function then manipulates the data. It is my understanding ...
Andrew Payne's user avatar
3 votes
1 answer
107 views

I'm currently working on an application using Compose and Hilt, and occasionally (less than 10 times out of 1000 according to my automated tests), the order of calls to my ViewModel differs, leading ...
rolandl's user avatar
  • 1,907
0 votes
1 answer
29 views

i've been working on this assignment of mine. to make a unit test on a viewmodel. but the viewmodel actually fetch token from api. is making a dummy for the token right? also i have a problem to make ...
Charlie's user avatar
0 votes
1 answer
64 views

I am a bit new to MVVM, I have a complex model List<List<SomeClass>>, lets call it a board, I want to bind it to a ...
ycsvenom's user avatar
0 votes
1 answer
154 views

I have a fragment HomeFragment which is part of the app navigation graph. Within FragmentHome I have a viewpager with 3 fragment ...
rdias002's user avatar
  • 234
0 votes
1 answer
55 views

I have an abstract class: ...
Monica's user avatar
  • 446
0 votes
0 answers
68 views

Let's assume I have two screens: Screen A Screen B. When I send a NavigationUiEvent.ShowScreenB to the NavigationModel, the <...
Mackovich's user avatar
  • 3,659
1 vote
3 answers
364 views

How do I import androidx.lifecycle.viewmodel.compose.viewModel on Kotlin Multiplatform (iOS, web, desktop, Android)? Attempts: ...
Samuel Marks's user avatar
  • 1,960
0 votes
1 answer
46 views

What I'm looking to do is create and write all my methods in my view model file, and only place code in the code-behind file for functions that are automatically generated like ...
Bob Gatto's user avatar
  • 178
0 votes
1 answer
40 views

I am trying to make a simple app that uses firestore, that just insert the token of devices and fetch the names corresponding to that token. When I tried to fetch "name" value , the flow in ...
Prakhar_Pathak's user avatar
1 vote
1 answer
286 views

I am migrating an application from View to Compose. The application was written in Java so I need to migrate the UI to Kotlin. I prefer to do it as gradually as possible so I'm leaving the ViewModel ...
Shaul's user avatar
  • 469
0 votes
1 answer
59 views

All the data comes from the server in bulk. I cannot influence its volume. Therefore, to reduce the number of requests, I store this data in a single ViewModel, which I share on all screens. I ...
pie's user avatar
  • 173
0 votes
1 answer
115 views

How can I fix the issue of StateFlow values not updating? The value of StateFlow is not assigned to the BoardRequestDto object. The latest value of StateFlow is not properly collected in the ...
Bumblebee's user avatar
1 vote
2 answers
84 views

I'm creating a website where you can Create an event for a game.I have a Create Page. The page has a GameID field when creating a new Event. I'm attempting to use a ViewModel so that I can display the ...
Jimmy Dictus's user avatar

1
2 3 4 5
100