I am a passionated non-professional programmer and I'd say I'm an expert in php and MySQL - I am able to program an entire web application in php with the look and feel of an iOS app, but.... it's still a web app.
Many times I started with swift and Xcode in the last years. But because it feels so different to me and it feels like handling code in Xcode with Swifft changes very often (e.g. SwiftUI), I stopped every time.
I have a very cool app in mind, but I'm bored of the next php web app project and I really want to realize it in iOS. With that I am directly confused with how data is stored.
To use my skill, I could create a php API and a MySQL database and use http requests. Fair enough...
But what if the user has no internet connection? I think of having two databases - one on the device and one in the internet. I already did a to do list tutorial with core data and swift ui.
To have something to talk about:
When the app starts, there should be a listview with accounts. Each account has a unique id and users can add accounts when they share the unique id. With that, multiple users are able to access the same data item. One creates the account and the random unique id and another user can add the account item to his app.
Each account has as list of multiple users that are related to that account and each account has a list of transactions that can be created by each users.
Additionally I can decide which user I am. In php I'd use a dropdown with a list of users and I'd store the value of the selection in a session.
If it helps to understand, I add my database structure:
CREATE TABLE `pay_accounts` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`share_id` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `currency` (`currency`),
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `pay_transaction_users` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`user` int(11) unsigned DEFAULT NULL,
`amount` float DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `user` (`user`),
CONSTRAINT `pay_transaction_users_ibfk_1` FOREIGN KEY (`user`) REFERENCES `pay_users` (`id`) ON DELETE SET NULL ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `pay_transactions` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`date` timestamp NULL DEFAULT NULL,
`payer` int(11) unsigned DEFAULT NULL,
`amount` float DEFAULT NULL,
`purpose` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `payer` (`payer`),
CONSTRAINT `pay_transactions_ibfk_1` FOREIGN KEY (`payer`) REFERENCES `pay_users` (`id`) ON DELETE SET NULL ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;---------------
CREATE TABLE `pay_users` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`account` int(11) unsigned DEFAULT NULL,
`mail` varchar(255) DEFAULT NULL,
`activity` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `account` (`account`),
CONSTRAINT `pay_users_ibfk_1` FOREIGN KEY (`account`) REFERENCES `pay_accounts` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
My direct confusion is: In php it is very easy now to create a from with HTML and add the data to MySQL... in Swift I am completely lost on how to realize that project.