Native Shopify Mobile App with 20 new features
Kickstart your hyperlocal marketplace in Corona pandemic with a starter guide
Android App Development
iOS App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 188.8.131.52 release ready!
Owner and Founder. Opencart
Nows-a days offline mode is a very common feature in app development. Every developer wants to run minimum app functionality without internet and device connect with internet all data automatically sync on remote DB. CoreData, SQLite, Firebase, etc. is handling offline functionality. Today we discuss about SQLite using swift.What is SQLite?
SQLite is a C-language library that implements a small, fast, self-contained, high-reliability, full-featured, SQL database engine. SQLite is the most used database engine in the world. It is built into all mobile phones and most computers and comes bundled inside countless other applications that people use every day.Source: https://www.sqlite.org/Let’s implement SQLite in swift for offline applications.
In this example, we will use the FMDatabase library to access SQLite.
Swift version: 5.2iOS version: 14Xcode: 12.0
First Create a project from Xcode.
File ▸ New ▸ Project…. Choose the iOS ▸ Application ▸ Single View App template and create a new project.
Step 1: First copy .sqlite file from FileManager to application.
Note: Make sure .sqlite already added on your project.Step 2: Now create a DBHelper class, where we create all the oparations.
Step 3: Now We will create Insert update,delete and select oprations.For Insert:
For Update value in the DB:
To delete Row form the table:
Now get all the row from the table:
Step 4: Now we call the function that we already created.
I hope this code will help you better to understand SQLite in Swift. If you feel any doubt or query please comment below.
Thanks for the read this blog and if you want to visit my other blog click here.
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
Very good company, we did get app extension for Magento 2 website. The support was very good they help us through the process. Webkul team is very supportive, I would recommend them.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.