arrow_upward

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
#6
I thought I would check in and talk about some of my findings! So I started working with RestAPI trying to pull data from the TBDC Wordpress Site and WooCommerce. I have been fairly successful, thought I need to figure out how to get information from nested structures. With Swift, you are able to create what is called an observable object that you can use to parse JSON data and plug it into interface elements and user data. For example, the Structure "struc" I am using looks like this.

struct Products: Codable {
     var id: Int
     var name: String
     var status: String
     var price: String
     var images: [ProductImages]
}

struct ProductImages: Codable {
     var id: Int
     var src: String
}

So a function will run pulling the JSON remotely, then use these Codable structures to store the data to use in the interface.

ForEach(productData, id: \.id) { product in
     productCard(productName: product.name, productPrice: "$\(product.price)")
}

Doing so produces a result like this!

[Image: Simulator-Screen-Shot-iPhone-11-Pro-Max-....37.59.png]

The next step is to figure out how to 1) get the data from the sub struc ProductImages then 2) start building a cart, payment system and have that all tie into Stripe and WooCommerce.
Thank you to CubeData and Posts4VPS for the services of VPS 8.


Messages In This Thread
TBDC iOS App - by tbelldesignco - 02-18-2021, 02:19 AM
RE: TBDC iOS App - by tiwil - 02-18-2021, 12:09 PM
RE: TBDC iOS App - by tbelldesignco - 02-18-2021, 02:23 PM
RE: TBDC iOS App - by tiwil - 02-19-2021, 01:40 AM
RE: TBDC iOS App - by tbelldesignco - 02-19-2021, 03:22 AM
RE: TBDC iOS App - by tbelldesignco - 03-09-2021, 02:51 PM

person_pin_circle Users browsing this thread: 1 Guest(s)
Sponsors: VirMach - Host4Fun - CubeData - Evolution-Host - HostDare - Hyper Expert - Shadow Hosting - Bladenode - Hostlease - RackNerd - ReadyDedis - Limitless Hosting