Flashcard app store questions and answers - ios

I am creating a very simple flashcard app. It is a very basic app, the initial screen asks users to select a language. From there they pick from 5 categories. After selecting a category the user should get a random question (out of 20 possible questions).
My question is I want a question to not show up again within that set of 20 until all the other questions in that set have been shown. Similar to a deck of cards where the viewed card goes to the bottom of the deck.
The second question is what framework would be best for this application. There are 200 questions in total, all text, no images. My inclination would be to use something like core data or would that be overkill?
Any help on how to best implement this would be appreciated! I've attached a picture for further clarification.Storyboard Layout

You're doing a great job so far.
There are many ways to track your cards. The simplest might be to add a Boolean property to the card definition. Call it something like "hasBeenAnswered" and set it to false. As a card is retired you can set this to true. Refresh your data source after a correct answer by removing the card from your data source and also setting the book to true, or simply set it to true and replace your data source with all cards which are set to false. (Perform the same fetch you used to get your initial set of data: all cards where hasBeenAnswered is false)
On your second question I'd try to learn Realm. It's easier to pick up than core data, and as a cross-platform tool, you can leverage what you learn on iOS if you ever try to develop on mac or android platforms.
You can also refactor the project to core data after it works the way you want to. And learn even more.
The suggestions I've made are not the most resource efficient, but you won't have any performance issues given the size/scope of your project.
Good luck 🍀

Related

iOS background tasks synhronization app flow

I'm programming in iOS not so long. I was mainly programming UI related stuff like animations, custom UIControls etc.
I need in my new app to:
Display loading activity indicator and in the same time:
load some remote data from server parse them and store in local core data
load some data from local core data
get user position from location service
After this I have all data needed to display next view controller and dismiss loading indicator.
Question is how can I do this all? I need to support iOS9, iOS10, 11, 12. I understand that this needs to be done in background threads and then I need to merge all data from each task and switch to next view controller. I can't use any external libraries like rx-swift or promise-kit. Maybe there is any experienced iOS developer who can give me some main guidelines how to approach to this kind of application flows? I can imagine there is a lot of ways I can do it some of them are better and some of them are worse. Any guidelines would be very helpful for me. Thanks.
It's a very complex question and as you said it's possible to solve all this problems in several ways. But for sure i can give you some core-hints about which steps is better to follow:
Run in a separate thread the management of all stuff regarding to the Network communication. Maybe you can run it on a separate queue using the class DispatchQueue(). Once you received the data, in the same thread, maybe you can directly convert these information and store them inside a CoreData database.
To store into CoreData you need at first to know how it works, so basically search for some really easy tutorial about how to create from zero your first database inside XCode. After you have been able to run and execute a very simple one you will be able to pass to the second step and so try to integrate it with the data you have previously downloaded from the network. Here a good article for you: https://www.raywenderlich.com/7569-getting-started-with-core-data-tutorial .
To get the location is a separate field of study, because you have to study which background modes are allowed in iOS (And actually are allowed just a few). After that you will need to figure out in which category of background-location application your software belongs. After that you have to dig deep and discover how protocol and delegates works inside Swift/Objective-C in order to properly manage the last location value retrieved by the sensors. Here is a good article for you: https://www.raywenderlich.com/5247-core-location-tutorial-for-ios-tracking-visited-locations.
At the end when you interconnected all this flows you can think about how to display the loading indicator. Basically you need to drag and drop it from the tools into the storyboard, interconnect it by using the IBAction or IBOutlet, depending on when you wanna show it and in which specific case. And then use the relative method startAnimating or stopAnimating in the right code flow (It really depends on how you have structured all the previous bullet points).
Since your question was very general and it includes a lot of sub-steps, basically it really needs to be thorough studied and analysed.
I've tried to sum up as much as possible the most important bullet points. I hope the links i suggested to you will help a little bit. Good luck.

save to local storage swift

I am designing an idle clicker style app, as I am quite new to programming and thought it would be a good personal project. However I am trying to design the upgrades on a second ViewController menu, however every time that the user leaves the first ViewController, all the settings on that page are lost e.g. stats. I know that there are already similar questions, but they don't relate to my issue and I am having difficulties trying to understand them.
I was just wondering if someone had any way to save this progress both when the user moves to a new viewController and when the app is closed and reopened. Also this might be pushing it, but if you could describe what each part of the code does it would be very helpful.
Thanks
Best is to use UserDefaults to store page contents. You can define key/value pairs and save and load values as needed. Look for it in the IOS documentation. It is very easy to implement it.

Annotating PDFs: where to begin?

I'm taking a beginning mobile development class, and my professor wants me to jump right in and help him with an app of his written in Objective-C, and I have 3 months. I have taken a few other CS classes so far, but no next to nothing about mobile app development.
This app is basically a songbook that holds many PDF files of music scores. The first (of multiple things) that he wants me to add is the ability for a user to annotate the music score with highlighter, pen, and eraser. Since there are many music scores, I would need to have the app save these annotations for each score, and allow editing by the user later if needed (i.e. allow the user to go back and erase stuff and add more annotations to a given score).
I'm in the planning phase and I'm trying to figure out the best way to do this. I was thinking of having the annotations occur on a second view layer, and then saving that layer as an image so that it can be overlaid back onto the music notes sheet at any time (for the user to view). My concern is, would the user be able to re-annotate this layer once it has been saved as an image (i.e. erase and add more annotations, then save it again)?
Or what's the best way to go about this? I would really appreciate any advice because I am in over my head!
Well This is very broad question to answer it but let me help you with some links and you will need to go through that like.
It will help you to start your requirements into app.
There are many 3rd party frameworks are there for PDF annotations:
PSPDFKit (Paid)
FastPDFKit
Poppler (OpenSource)
There are some SO Questions links which also helps you for PDF annotation
Add Annotation to PDF
Annotation on an PDF
Programmatically add annotations on PDF
Some Github Links
LazyPDF
Note: LazyPDFKit - (No longer maintained - Use the source code to fix
the bugs)
Hope this will helps you in your research.

How to show tabular data in a nice and practical way

My iOS app is a mobile version of a management program I had developed for a company as a desktop application. So its main tasks are saving data in a database and retrieve them when needed with the option to edit them. So I guess that the GUI is mainly composed by forms to fill in and tables to show data. So I am asking you if you could link me some tutorials or give me some tips on how to realize them in a nice way but not too complex. I'd rather avoid simply creating a blank view controller and inserting labels and text fields without a minimum of criterion. I am very new to iOS and XCode and, as I have not too much time, I am asking directly your opinion instead of spending hours in looking for tutorials.
UPDATE!
I mean that I would like to get something similar, for a mobile iOS device, to the following screenshots (from the desktop application I mentioned above)
Seems that you need a grid control to do it.
You can develop your own, or use existing library.
I have very good work experience with Infragistic http://www.infragistics.com/products/ios/grids/grid-view-layouts, but maybe DataForm from Telerik will be better in your case http://www.telerik.com/ios-ui/dataform

Best way for storing 100+ questions and answers

I am designing an exam practice app that will have the following format, requiring the user to rank the answer 1-5 to sections A-E (using a scroll view) for the same question that will be displayed at the top.
Here is an image:
Each question therefore has 5 parts. I am unsure of what is the best way to store the questions and answers. I read something about plists. Would that be the way to do it? If so, could you recommend any tutorials with images?
Just to clarify, the labels A-E are where the text for the subsections will go and the user will have to rank the appropriateness for each of these.
Thank you!
Few options here:
1. Core Data
Prepopulate .sqlite file with questions and include with app. Keep track of user's progress and attempts and whatever other stats.
This approach also give your ability to label questions by a topic (or any other criteria) and present questions to user that they need or that they failed most.
2 Get data from server
A bit more complicated but offers more benefits. With this approach you would be getting questions in json format.
Benefit of this approach is that you can add any number number of questions and tests without resubmitting your app.
3. Store as text/plist with app
Yes, you can also store your questions as text in plist or json format and as app loads populate core data or keep it in memory to display. The latter approach, however, would offer the least amount of benefit and flexibility to the user.
I suggest using SQLite. See Ray Wenderlich's Tutorial on SQLite for iOS
And there is obviously a not so suitable but easy way and that is using property lists as key and value pairs which i do not recommend.

Resources