(OLD) Taking basic order details – Cupcake Corner SwiftUI Tutorial 4/8

preview_player
Показать описание
In this project we cover how to make a type conform to Codable when it has @Published properties, how to send and receive network data, and more.

Рекомендации по теме
Комментарии
Автор

Questions? Comments? Tweet me @twostraws.

twostraws
Автор

The Error you experienced @04:00 is now gone. I did not experience it. Date:13 July 2021

goldenchimsy
Автор

This is a trivial criticism of your excellent tutorials (which I acknowledge are about SwiftUI and not basic programming) but I though I'd mention it because bad habits are easy to learn and difficult to unlearn.


I would suggest that the Order class should read:
    static let minQuantity =  3
    static let maxQuantity = 20
    @Published var quantity = Order.minQuantity

And the Stepper in the ContentView should read:
Stepper(value: $order.quantity, in:

vjosullivan
Автор

6:26 - The if Condition is not needed here or am I missing something? When set to true (activating special request) it should start with both false, and when set to false (deactivating it) then also both are set to false.

DanielZielinski
Автор

I ran it at the time you suggested and did not get the error you mentioned, however, I got the following warning. OrderCupcakes[77915:3776270] [TableView] Warning once only: UITableView was told to layout its visible cells and other contents without being in the view hierarchy (the table view or one of its superviews has not been added to a window). This may cause bugs by forcing views inside the table view to load and perform layout without accurate information (e.g. table view bounds, trait collection, layout margins, safe area insets, etc), and will also cause unnecessary performance overhead due to extra layout passes. Make a symbolic breakpoint at to catch this in the debugger and see what caused this to occur, so you can avoid this action altogether if possible, or defer it until the table view has been added to a window.

judy
welcome to shbcf.ru