Can ChatGPT write better SwiftUI code than you?

preview_player
Показать описание
In this video I'll show how we can use ChatGPT to generate SwiftUI code that recreates Apple's Clock icon on the Home Screen. I'll then walk you through building the same thing ourselves, so you can see how the two solutions compare.

00:00 Introduction
03:27 Using ChatGPT to write SwiftUI code
06:40 Asking ChatGPT to fix its errors
09:16 Trying what ChatGPT built
11:38 Building the project ourselves
19:10 Adding details to the clock hands
19:53 Adding a second hand
20:59 Constantly sweeping hands
23:11 Drawing an inner ring
25:45 Adding hour numbers
29:09 Bugs and performance
31:55 Final scores
32:43 Tips for using ChatGPT safely
36:19 How programmers can use ChatGPT effectively
37:30 Is ChatGPT 4 better?
Рекомендации по теме
Комментарии
Автор

Frankly speaking, I'm using ChatGPT for Swift development A LOT. Here's some essential cases: 1) RegExp, predicates, SQL requests, bc my lazy ass can't remember them all. 2) Explaining Xcode errors. 3) Throw 300—400 lines of file and ask "any ideas how to simplify it?". 4) Asking something like "what properties does TextField have", bc its output is more readable than Apple documentation. Although, there was a case when ChatGPT was smarter than me: I need to make a fetch request with a predicate that has a variable from another core data entity, but both requests must be done with a property wrapper (bc without it the view won't update). And ChatGPT came up with the idea better than I had, kudos to it (him? her?). So, it is usable, very usable.

foilhat
Автор

That was both a great discussion of how to approach a problem in SwiftUI, and a good overview of the limitations of ChatGPT (or any AI, for that matter). I have found that it really is only good at handling small(ish) problems. What I found most startling, though, was how much better ChatGPT 4 did. As you were discussing your solution, I was wondering why you didn’t just smooth the hands with withAnimation (you can code around the rollover case) but I think your approach with the timeline is much better.😊

toadlguy
Автор

Thank you for making this video. Just yesterday I was trying to learn Vision and Core ML and use the classifier in SwiftUI. Code provided by ChatGPT kept giving me errors. Went back to Google and found the code which actually worked.

hemanthpulimi
Автор

This would be a pretty epic take home test for a job application 😊

ChristopherFonseka
Автор

I am new to Swift UI development, having come from a Python background. I am a big fan of your tutorials and have been mastering SwiftUI by following them. While I found ChatGPT to be a useful tool for expediting coding when working with familiar code, I have found that refactoring my own code is a more effective long-term strategy. ChatGPT can be useful for writing and asking general questions

mohammadjavan
Автор

Bing Chat did an amazing job on its first pass with your analog clock prompt.

JohnNyquist
Автор

Thank's for video. I'm writing chat screen right now for corporate application and it's hard for me to imagine how i can tell ChatGPT to make architecture kind of stuff. Still it could be very usefully to make very little simple things. For example: "Draw me a rectangular with some width and height which will be that color and that shadow parameters". That's first what comes in mind. Thank you again Paul for video !

lukashman
Автор

It’s great for dredging up API details from various vendors

rscottlewis
Автор

I really enjoyed this and felt informed at the same time. I love your clear methodical approach.

ahmedghonim
Автор

For the code that I'm writing, it's much faster to write the code myself, than trying to express what I want in words.

dannestrom
Автор

Thanks for the great video. I've a kind of ignored ChatGPT and other AI tools until now. But it get's more and more important, so I've just started to learn more about it. The essential term is "let ChatGPT help me write code". I don't think that it will replace an experienced developer in the next few years. I read on Twitter the other day: "Product mangers need to formulate very well to get what they want from ChatGPT. So we are safe!!" 🙂

dimiutube
Автор

Such a great discussion Paul! My recent thoughts about ChatGPT totally aligns with what you said. Its a tool we can use to HELP ourselves explore alternatives and have discussion on BROADER level. Expecting it to give a full fledged code is not the state it is at right now. 
Devs who are at responsible position should NOT use ChatGPT carelessly. A meticulous review should be done, and verified before making use of that code.

Regarding context, the immense human ready context you built while creating the clock was so detailed that it will need a machine a good pause, and large amount of visual and verbal input to have that context.


Nevertheless, the state of ChatGPT is very impressive today. I keep thinking about how the future generation of work is going to look like....

ayyanchira
Автор

Great video! I enjoy experimenting with ChatGPT, but I believe it requires significant guidance since it often fabricates information and assumes it's entirely accurate, as you mentioned. I find it particularly useful for generating mock data or when working with a large SwiftUI View that I've written in a single file while tinkering with code. In such cases, I ask ChatGPT to extract parts of the code into subviews.

a_swiftly_tilting_planet
Автор

The GOAT has uploaded once again. I have learned so much from you not only about SwiftUI but also about programming. Your 100 days with SWIFTUI is the best course I have ever taken

drakata
Автор

I asked GPT 4 and it gave me a quite beautiful one on the first try. Same exact prompt. No prompt engineering required. That's truly to concern, it is just going to get better and better at an exponential rate. However, I dont think it will take developer jobs for quite a while, even a simple app requires the integration of thousands of lines of code, dozens of files and the context of the problem and the anticipation of how people will interact with it. (edit: I should have finished the video, I am 'that' guy.)

hickam
Автор

Very nice take on a huge huge new perspective to coding. Very nice points, and shows the perspectives we need to have in mind for the future. Great job as always Paul! 🙌

Skjoldborg
Автор

Awesome explanation Paul! I've recently been using ChatGPT for documenting my code and writing tests, and those libraries contain a big amount of detail. Since that's the 'sloggish' part of programming, I can definitely recommend diving into those use cases for future videos.

joannisorlandos
Автор

As somebody just learning how to program I have already found chat GPT more useful than Youtube Tutorials on a number of subjects. I was trying to figure out how to make a simple cube in SceneKit for quite a few hours before I finally gave up and just asked chat GPT, who got it in half an hour or so. Problem with YouTube videos is they all videos on SceneKit used it with UIKit instead of SwiftUI. Problem with Chat GPT is that I kept needing to clarify what I wanted, and feed it error messages.

FlashGamer
Автор

Great explanation again Paul, thx. I fully agree (even before I saw your video) that ChatGPT is a 'Helper'. And for me it's a nice helper for improving my developing skills, and for extending a first idea to a better solution. I don't see yet that it will replace me as a programmer. But... didn't we all start as a helper and (some) become an expert ?!?

GeraldHilbers
Автор

Excellent video! I have not used AI in any projects yet because of the very same issues that you have pointed out. I think the fundamental problem is that an uninformed user may take the result of an AI query as “truth” when in fact the answer is wrong, but delivered with “confidence.” “Strong men” throughout history have used this same approach to recruit the masses. Say it with sufficient authority and they will believe you…

feldyrios