Show TableViewCell results after updating data - uitableview

I'm doing personal projects to learn more about Swift. Right now, I'm working Bill Alert App just to test concepts and learn Swift concepts.
I'm using a TabBar where Item 1 is a outstanding bills which is addable while Bills Paid (BillLogTableViewController) consists of bills that I've marked as Paid.
All these records are entered into SQLLite via Core Data.
After marking an outstanding bill as paid, and I tap on BillLogTableViewController I noticed that the latest bill that I just tapped as 'Paid' isn't display.
I found a way to resolve this by calling the bill table where paid = 'Y'
in BillLogTableViewController didLoad.
However, I would like to know if there is a better way to do it without calling the table whenever I tap on the Bill Paid tab such as displaying the data in the Bill Log tab whenever a bill is marked as 'Paid' automatically.
Totally appreciated for any suggestions given.

You need to call tableView.reloadData() when you change your model.
It is perfectly fine to call it on viewWillAppear() in the View Controller containg the UITableView.

Related

How can I access/fetch all the details of a particular contact, if I already have his/her name with me?

Basically, I've a tableview which displays all the contact names (just like built-in contacts app in ios) stored on the device, in my app. I want to add a page which shows up when I click a cell in the tableview, and in that page I want to display all the details of that particular contact tapped in the tableview.
I've fetched all the contacts in the tableview using Contacts() in swift5. It was very easy. But now I want to retrieve (and show on new page) all details of any particular contact, which maybe variable for different contacts, for example some may have 3 numbers, some may have 4, some may have birthday some may not.
I tried searching on the internet a lot, but couldn't find anything suiting to me scenario. Any help will be much appreciated.

Should I use queries in firebase or the observe functions?

I am building out an iOS app that requires getting lists of users at different parts of the app(finding users nearby, find users that have similar interest etc) I'm displaying the list of users in collection views/table views.
I have a user structure that contains all of the user data(name, photo, list of interest, location, preferences..etc)
My question is, when I'm getting the list of users from the database, is it more cost effective to use the query function or to use the observe functions? In the list I only need to display the users photo and username. If the user wants to find out more then clicking on the cell will get more data from the larger user data table.
My options
using a query to get the users that meet the criteria for that list(say all users nearby). Then when the user clicks on the cell that interests them, get a snapshot from the database for that specific users.
My thought process is its less costly than pulling back the whole snapshot using the observe functions.
using the observe functions, getting all users snapshot data and only displaying the photo and username. If the user selects a cell send the data to the detail view.
creating a special display structure that contains only items necessary for the collection view/ table view and if the user clicks on a cell call the database again getting all of that users data.
If anyone has a point of view they could share that would be great!
Thanks
Observing in Firebase needed for making instant update, like in chats, when new message appear you need to update message list. So here, for getting list of users that fit your request, better to use queries

Google Sheets: Keeping static data aligned with data returned from a query as new data is added on top

first time poster but I've been able to solve a lot of problems with through the brilliant answers this community provides to users. So, firstly, thanks!
I'm making a Job Request tracking spreadsheet as well as using a Google Form to get the input data.
Jobs fall under categories of Building, IT, Keys, Maintenance and OHS as asked in the first question of the Google Form.
Depending on which category is selected, the user will go to a different section of a form with different questions.
That's all working great.
The data for all responses is saved in the same form response sheet and then using the Query function I have 5 sheets set up, one for each category, and I'm reading the relevant data into each sheet. The data is sorted based on date and time so that the most recent entry is at the top of the sheet.
To the right of each data set on each individual sheet I want to track whether the job is Completed, Pending, Not Approved. I want to track who gave it approval, and so on.
The problem is that when new data comes into the sheet it moves to the top as it is the most recent data. But the Completed, Pending, Not Approved, and other notes will not move down the sheet with the older data.
Help would be greatly appreciated.
Thanks!

Ideas to store an TableView for different Users on Parse

I have an application where the user needs to sign in first. Now in my application there is an table view which can be filled with different events for example: a user adds an Title for a new event and an yellow icon. Now the Title and the yellow icon appears in the tableview.
Now i want the app to sync with Parse so that this user can see it's Title and it's yellow icon on every device he's logged in.
I'm sorry that i need to ask, i hope you can help me :/
Actually there is already a lot of content regarding your question and the Parse SDK is very well documented.
For example have a look at this: Save App Data to Parse Backend
You should do the following steps:
Create an App on Parse
Create User Table
Create AppData Table
Reference the User with the AppData entry via column type : "Pointer"
Whenever a entry was added to your tableview or whenever the app is closed save the current data to your parse backend
Whenever the tableview is shown or whenever your application starts retrieve the information from your Parse backend and show them in your tableview accordingly
I hope the link I gave you can give you some insight, however nobody knows whether you are coding in Swift or Objective-C because you added both tags.
If you need more information on how to design your backend in order to retrieve the right entries for the specific user I recommend reading this:
find-all-objects-belonging-to-a-user-with-objectid
or reading about relational queries in the Parse SDK.

Data storage dilemma - As an integer count or as an association?

This one should be pretty easy for an experienced programmer to answer.
I've got a Rails App where users are encouraged to click different buttons that are featured all around the site. When it comes to storing the data, I need to record two things:
1) The total number of people that have clicked each individual button.
2) The number of unique people that have clicked each individual button.
95% percent of the time, I don't need to know WHO the people that actually did the clicking are. This data is accessed very frequently. The other 5% of the time I DO need to know who clicked what, and I need to iterate over those people and perform certain actions.
Right now I have a Click model that records the user and the button for each click. What I'm not sure about is whether I should be doing some sort of unique select on the clicks to find the unique ones, or if I should create a separate model for unique clicks. Furthermore, would it be smart to create a num_clicks column for the button model and increment it each time someone clicks as well as adding the click as a record? Or should I just do a select count(*) each time?
Thanks for the help!
You can use the counter cache columns for all your purposes.

Resources