chatGPT writing swift code


@rudifa Sun Dec 18 18:21:28 CET 2022

The code in the ViewController was generated by the chatGPT in response to my prompts and questions.

The transcript is found here.

Overall, it did generate several useable solutions, but also some that did not compile, and some others that compiled but did not work.

My initial prompt was

In a UIViewController, I want to fetch an image form a public website, 
asynchronously, and display it in a UIImageView

My last prompt was

ok, this works; can you improve it by adding a button to press to get another image?

and the generated code works.

In between, I tried to get a modern (as of 2022) swift solution using async/await and throw/catch, but it never got there. It looks as if it was trained on material that is about a year old.

Anyway, this is impressive, from a truly general-purpose AI system.

Here is the app, in a simulator.


View Github