iPhoneアプリ

We have developed an iPhone app using GPT-4 that function similarly to the “MoleMash” App Inventor app. Xcode12.2 on macOS 10.15.7 is used. Keep in mind that large language models, such as Google’s Bard and OpenAI’s GPT-4, do not return the same results when given the same prompt.

 

Prompt

Do you know App Inventor App called MoleMash?

Answer

Yes, I am familiar with the MoleMash app, which is a simple game created using MIT App Inventor. App Inventor is a web-based, visual programming environment that allows users to create Android apps without any prior coding experience. MoleMash is a classic example app often used in tutorials to help people learn how to use the platform.

In MoleMash, a player tries to hit a randomly appearing mole by tapping on the screen. The mole appears at different locations on the screen, and the player earns points by successfully tapping on it. The game usually has a timer, and the player aims to score as many points as possible within the allotted time.

The MoleMash app demonstrates various aspects of App Inventor, such as creating and manipulating images, handling user input (touch events), using timers, and updating labels to display scores. The simplicity of the game makes it a great starting point for beginners to learn how to create Android apps using App Inventor.

Ask to summarize functionalities of this game here, because GPT-4 will create strange code without it

Prompt

Summarize functionalities of MoleMash.

Answer

MoleMash is a simple game created using MIT App Inventor that demonstrates basic app functionalities. The key features of the game include:

  1. Randomly appearing mole: The mole appears at different locations on the screen for the player to tap.
  2. Touch events: The app detects and processes user input when the player taps the mole.
  3. Timer: The game incorporates a timer, typically counting down, to add a sense of urgency and challenge.
  4. Scoring system: The app keeps track of the player’s score by counting successful mole taps.
  5. Display updates: MoleMash updates labels on the screen to show the current score and time remaining.

Prompt

Create an iPhone App which works like App Inventor App called MoleMash using Xcode 12.2 and SwiftUI. I don’t want to use storyboard. Add comments to this code for easy understanding.

Answer

Creating a full iPhone app in this format is beyond the scope of this platform. However, I can provide you with a general outline of the structure and some sample code snippets to help you get started with creating a MoleMash-like app using Xcode 12.2 and SwiftUI.

  1. Create a new SwiftUI project in Xcode.
  2. In the ContentView.swift file, remove the default Text view and replace it with the main view of your app. Here’s a simple structure:

import SwiftUI

struct ContentView: View {
    @State private var molePosition = CGPoint(x: 100, y: 100)
    @State private var score = 0
    @State private var gameTimeRemaining = 30
    @State private var gameTimer: Timer?

    var body: some View {
        VStack {
            // Display score and time remaining
            HStack {
                Text("Score: \(score)")
                Spacer()
                Text("Time: \(gameTimeRemaining)")
            }
            .padding()

            // Game area
            ZStack {
                Rectangle()
                    .fill(Color.green)
                    .frame(width: 300, height: 400)
                    .onTapGesture(perform: handleMissedTap)

                // Mole image
                Image("mole")
                    .resizable()
                    .frame(width: 50, height: 50)
                    .position(molePosition)
                    .onTapGesture(perform: handleMoleTap)
            }
        }
        .onAppear(perform: startGame)
    }
}
  1. Add functions to handle the game’s logic:

extension ContentView {
    func startGame() {
        // Start the game timer
        gameTimer = Timer.scheduledTimer(withTimeInterval: 1, repeats: true) { _ in
            gameTimeRemaining -= 1
            
            if gameTimeRemaining <= 0 {
                gameTimer?.invalidate()
                // Handle game over
            }
        }
        
        // Start mole movement
        moveMole()
    }
    
    func moveMole() {
        molePosition = CGPoint(x: CGFloat.random(in: 50...250), y: CGFloat.random(in: 50...350))
        
        DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
            moveMole()
        }
    }
    
    func handleMoleTap() {
        score += 1
        moveMole()
    }
    
    func handleMissedTap() {
        score -= 1
    }
}

  1. To add the mole image, drag and drop a suitable image (e.g., “mole.png") into the Assets.xcassets folder.
  2. Run the app on a simulator or a physical device to test its functionality.

This code provides a basic MoleMash-like app using SwiftUI. You can further customize the visuals, add animations, and refine the game logic according to your requirements. Don’t forget to include comments throughout the code to explain each step and make it easier to understand for others who might read or modify it.

Added minor adjustments.


import SwiftUI

struct ContentView: View {
    @State private var molePosition = CGPoint(x: 100, y: 100)
    @State private var score = 0
    @State private var gameTimeRemaining = 30
    @State private var gameTimer: Timer?

    var body: some View {
        VStack {
            Text("GPT-4 MoleMash")
                .font(.title)
            // Display score and time remaining
            HStack {
                Text("Score: \(score)")
                Spacer()
                Text("Time: \(gameTimeRemaining)")
            }
            .padding()

            // Game area
            ZStack {
                Rectangle()
                    .fill(Color.white)
                    .frame(width: 300, height: 400)
                    .onTapGesture(perform: handleMissedTap)

                // Mole image
                Image("mole")
                    .resizable()
                    .frame(width: 50, height: 50)
                    .position(molePosition)
                    .onTapGesture(perform: handleMoleTap)
            }
        }
        .onAppear(perform: startGame)
    }
}

extension ContentView {
    func startGame() {
        // Start the game timer
        gameTimer = Timer.scheduledTimer(withTimeInterval: 1, repeats: true) { _ in
            gameTimeRemaining -= 1
            
            if gameTimeRemaining <= 0 {
                gameTimer?.invalidate()
                // Handle game over
            }
        }
        
        // Start mole movement
        moveMole()
    }
    
    func moveMole() {
        molePosition = CGPoint(x: CGFloat.random(in: 50...250), y: CGFloat.random(in: 50...350))
        
        DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
            moveMole()
        }
    }
    
    func handleMoleTap() {
        score += 1
        moveMole()
    }
    
    func handleMissedTap() {
        score -= 1
    }
}

Creating iPhone App with Xcode

Create a Xcode project

Launch Xcode and create an iOS App project named MoleMash, with Interface as SwiftUI and Language as Swift.

Paste swift code

Paste the swift code created by GPT-4 into ContentView.swift.

Run

The result is shown here.

 

 

 

iPhoneアプリ

We have developed an iPhone app using GPT-4 that function similarly to the “DigitalDoodle” App Inventor app. Xcode12.2 on macOS 10.15.7 is used. Keep in mind that large language models, such as Google’s Bard and OpenAI’s GPT-4, do not return the same results when given the same prompt.

Prompt

Chrome extension called WebChatGPT is used, because GPT-4 did not know DigitalDoodle.

Do you know App Inventor App called DigitalDoodle?

Answer

Yes, I am aware of the App Inventor app called DigitalDoodle. DigitalDoodle is a drawing app created using MIT App Inventor, an intuitive visual programming environment that allows users, even children, to build fully functional apps for smartphones and tablets [2]. The app enables users to draw on the screen of their device. The default setting for App Inventor is “scrollable," which means the user interface can go beyond the limit of the screen, and users can scroll down by swiping their finger [1].

There is also a tutorial video available on YouTube called “Intro Digital Doodle, MIT App Inventor Tutorial #4" that can help users learn how to create the DigitalDoodle app using MIT App Inventor [3].

Prompt

Create an iPhone App which works like App Inventor App called DigitalDoodle using Xcode 12.2 and SwiftUI. I don’t want to use storyboard.

Answer

To create an iPhone app similar to DigitalDoodle using Xcode 12.2 and SwiftUI, without using a storyboard, follow these steps:

  1. Open Xcode and create a new project.
  2. Choose the “App" template under the “iOS" tab and click “Next."
  3. Enter the app name (e.g., “SwiftUIDigitalDoodle") and make sure the “Interface" is set to SwiftUI. Choose a suitable location for your project and click “Create."
  4. Delete the “ContentView_Previews" struct in the ContentView.swift file since we will not use it.
  5. Inside the ContentView.swift file, replace the existing code with the following code to create a custom drawing view:

import SwiftUI

struct DrawingView: UIViewRepresentable {
    @Binding var points: [CGPoint]

    func makeCoordinator() -> Coordinator {
        Coordinator(self)
    }

    func makeUIView(context: Context) -> UIView {
        let myView = UIView()
        myView.backgroundColor = .white
        myView.addGestureRecognizer(UIPanGestureRecognizer(target: context.coordinator, action: #selector(Coordinator.panGesture)))
        return myView
    }

    func updateUIView(_ uiView: UIView, context: Context) {
        let path = UIBezierPath()
        path.lineWidth = 4

        if points.count > 1 {
            for i in 1..points.count {
                path.move(to: points[i-1])
                path.addLine(to: points[i])
            }
        }

        let layer = CAShapeLayer()
        layer.path = path.cgPath
        layer.strokeColor = UIColor.black.cgColor
        layer.fillColor = nil

        uiView.layer.addSublayer(layer)
    }

    class Coordinator: NSObject {
        var drawingView: DrawingView

        init(_ drawingView: DrawingView) {
            self.drawingView = drawingView
        }

        @objc func panGesture(_ sender: UIPanGestureRecognizer) {
            let point = sender.location(in: sender.view)
            drawingView.points.append(point)
        }
    }
}

struct ContentView: View {
    @State private var points: [CGPoint] = []

    var body: some View {
        DrawingView(points: $points)
            .edgesIgnoringSafeArea(.all)
    }
}

This code creates a custom drawing view by implementing a UIViewRepresentable struct called DrawingView. It uses a UIBezierPath and CAShapeLayer to draw lines based on user input.

  1. Now, run the app on a simulator or a physical device. You should be able to draw on the screen like the DigitalDoodle app.

This is a basic implementation of a drawing app similar to DigitalDoodle using SwiftUI. You can further customize it by adding features like color selection, undo, and redo actions, or adjusting the line thickness.

Creating iPhone App with Xcode

Create a Xcode project

Launch Xcode and create an iOS App project named Doodle, with Interface as SwiftUI and Language as Swift.

Paste swift code

Paste the swift code created by GPT-4 into ContentView.swift.

Run

The result is shown here.

 

iPhoneアプリ

We have developed iPhone apps using Google’s Bard and OpenAI’s GPT-4 that function similarly to the “Talk To Me (Part 1)" App Inventor app. Bard needed more steps. Xcode12.2 on macOS 10.15.7 is used. GPT-4 section is here. Keep in mind that large language models, such as Google’s Bard and OpenAI’s GPT-4, do not return the same results when given the same prompt."

Bard

Prompt

Do you know App Inventor App called Talk To Me (part 1)?

Answer

Yes, I am familiar with the App Inventor App called Talk To Me (part 1). It is a tutorial that teaches you how to create a simple text-to-speech app using the MIT App Inventor platform. The tutorial is divided into two parts: part 1 teaches you how to create a button that speaks when it is clicked, and part 2 teaches you how to make the app respond to shaking and let a user put in a phrase for the phone to speak out loud.

To create a Talk To Me app, you will need to have the MIT App Inventor software installed on your computer. Once you have installed the software, you can open it and create a new project. In the project designer, you will need to add a button and a text-to-speech component to your app. You can then connect the button to the text-to-speech component so that when the button is clicked, the text-to-speech component will speak the text that is displayed on the button.

Once you have created your app, you can test it by clicking the “Run" button in the MIT App Inventor software. The app will be installed on your phone, and you can then test it by clicking the button on your phone.

The Talk To Me app is a great way to learn how to use the MIT App Inventor platform. It is a simple app that is easy to create, but it can be used to learn some of the basic concepts of app development. If you are interested in learning more about app development, I encourage you to check out the MIT App Inventor website

Prompt

Create an iPhone App which works like App Inventor App called TalkToMe (part 1) using Xcode 12.2 and SwiftUI. I don’t want to use storyboard.

Answer

Sure, here are the steps on how to create an iPhone App which works like App Inventor App called TalkToMe (part 1) using Xcode 12.2 and SwiftUI without using storyboard:

  1. Open Xcode 12.2 and create a new project.
  2. Select the “Single View App" template and click “Next".
  3. Enter a name for your project and click “Next".
  4. Select a location for your project and click “Create".
  5. In the project navigator, select the “ContentView.swift" file.
  6. Delete the code in the file and replace it with the following code:

Code snippet
import SwiftUI

struct ContentView: View {
    @State var text = ""
    
    var body: some View {
        TextField("Enter text", text: $text)
            .padding()
            .onSubmit {
                // Speak the text that was entered.
                let synthesizer = AVSpeechSynthesizer()
                synthesizer.speak(text)
            }
    }
}

  1. Click the “Play" button in the top left corner of the Xcode window to run your app.
  2. Enter some text in the text field and press Enter. The text will be spoken aloud by your phone.

You can now use your app to speak any text that you enter.

Prompt

Remove textfield and always speech “Congratulations! You’ve made your first app.” when Speak button is clicked. Give me the whole code again.

Answer

Sure, here is the code for the app with the text field removed and the text “Congratulations! You’ve made your first app." always spoken when the “Speak" button is clicked:

Code snippet
import SwiftUI

struct ContentView: View {
    
    var body: some View {
        Button(action: {
            // Speak the text.
            let synthesizer = AVSpeechSynthesizer()
            synthesizer.speak("Congratulations! You've made your first app.")
        }) {
            Text("Speak")
        }
    }
}

This code creates a simple button that, when clicked, speaks the text “Congratulations! You’ve made your first app." You can now use your app to speak this text whenever you want.

Prompt

I got an error “Cannot find 'AVSpeechSynthesizer’ in scope"

Answer

I apologize for the error. The AVSpeechSynthesizer class is part of the AVFoundation framework, which is not imported by default in SwiftUI. To fix the error, you need to import the AVFoundation framework at the top of your code:

Code snippet
import AVFoundation

Once you have imported the AVFoundation framework, the error should go away. You can then try running your app again.

Prompt

I got an error “Cannot convert value of type 'String’ to expected argument type 'AVSpeechUtterance'"

Answer

I apologize for the error. The AVSpeechSynthesizer class expects an AVSpeechUtterance object as its argument, not a simple string. To fix the error, you need to create an AVSpeechUtterance object and pass it to the AVSpeechSynthesizer class:

Code snippet
let utterance = AVSpeechUtterance(string: "Congratulations! You've made your first app.")

let synthesizer = AVSpeechSynthesizer()
synthesizer.speak(utterance)

Once you have made this change, the error should go away. You can then try running your app again.

Prompt

Give me the whole code

Answer

Sure, here is the whole code:

import SwiftUI import AVFoundation

struct ContentView: View {

Code snippet
var body: some View {
    Button(action: {
        // Speak the text.
        let utterance = AVSpeechUtterance(string: "Congratulations! You've made your first app.")
        let synthesizer = AVSpeechSynthesizer()
        synthesizer.speak(utterance)
    }) {
        Text("Speak")
    }
}

}

This code creates a simple button that, when clicked, speaks the text “Congratulations! You’ve made your first app." You can now use your app to speak this text whenever you want.

Creating iPhone App with Xcode

Create a Xcode project

Launch Xcode and create an iOS App project named TalkToMe-Bard, with Interface as SwiftUI and Language as Swift.

Paste swift code

Paste the swift code created by Bard into ContentView.swift. The code is

import SwiftUI

import AVFoundation

struct ContentView: View {

var body: some View {

    Button(action: {

        // Speak the text.

        let utterance = AVSpeechUtterance(string: "Congratulations! You've made your first app.")

        let synthesizer = AVSpeechSynthesizer()

        synthesizer.speak(utterance)

    }) {

        Text("Speak")

    }

}

}

Run

The execution result is as shown here. It will talk when “Speak" button is clicked. You can watch the demo video by clicking the mage below.

GPT-4

Prompt

Do you know App Inventor App called Talk To Me (part 1)?

Answer

Yes, I am familiar with the App Inventor App called Talk To Me (part 1). It is a tutorial that teaches you how to create a simple text-to-speech app using the MIT App Inventor platform. The tutorial is divided into two parts: part 1 teaches you how to create a button that speaks when it is clicked, and part 2 teaches you how to make the app respond to shaking and let a user put in a phrase for the phone to speak out loud.

To create a Talk To Me app, you will need to have the MIT App Inventor software installed on your computer. Once you have installed the software, you can open it and create a new project. In the project designer, you will need to add a button and a text-to-speech component to your app. You can then connect the button to the text-to-speech component so that when the button is clicked, the text-to-speech component will speak the text that is displayed on the button.

Once you have created your app, you can test it by clicking the “Run" button in the MIT App Inventor software. The app will be installed on your phone, and you can then test it by clicking the button on your phone.

The Talk To Me app is a great way to learn how to use the MIT App Inventor platform. It is a simple app that is easy to create, but it can be used to learn some of the basic concepts of app development. If you are interested in learning more about app development, I encourage you to check out the MIT App Inventor website

Prompt

Create an iPhone App which works like App Inventor App called TalkToMe (part 1) using Xcode 12.2 and SwiftUI. I don’t want to use storyboard.

Answer

Creating an iPhone app similar to the TalkToMe app using Xcode 12.2 and SwiftUI without using a storyboard is a great project idea. I will guide you through the steps to create a simple version of the app.

  1. Launch Xcode and create a new project.
    • Select “App" as the template and click “Next".
    • Give your project a name, for example, “TalkToMeSwiftUI".
    • Make sure the “Interface" option is set to “SwiftUI" and “Lifecycle" is set to “SwiftUI App".
    • Set the “Language" to “Swift", and choose a location to save your project. Click “Create".
  2. Remove the default ContentView.swift file.
    • In the project navigator, right-click on “ContentView.swift" and select “Delete". Move the file to trash.
  3. Create a new SwiftUI file for your main view.
    • In the project navigator, right-click on your app folder and select “New File".
    • Choose “SwiftUI View" and click “Next".
    • Name the file “TalkToMeView" and click “Create".
  4. Edit the TalkToMeView.swift file to create the user interface:
import SwiftUI

import AVFoundation

struct TalkToMeView: View {

    @State private var inputText: String = ""

    

    var body: some View {

        VStack {

            TextField("Type something...", text: $inputText)

                .padding()

                .textFieldStyle(RoundedBorderTextFieldStyle())

            

            Button(action: {

                speak(text: inputText)

            }) {

                Text("Speak")

                    .font(.title)

                    .bold()

                    .padding()

                    .background(Color.blue)

                    .foregroundColor(.white)

                    .cornerRadius(10)

            }

        }

        .padding()

    }

    

    func speak(text: String) {

        let utterance = AVSpeechUtterance(string: text)

        utterance.voice = AVSpeechSynthesisVoice(language: "en-US")

        

        let synthesizer = AVSpeechSynthesizer()

        synthesizer.speak(utterance)

    }

}

This code sets up a simple user interface with a TextField for user input and a Button to trigger the speech synthesis. The speak(text:) function uses the AVFoundation framework to convert the input text to speech.

  1. Update the main app file (YourApp.swift):
import SwiftUI

@main

struct TalkToMeSwiftUIApp: App {

    var body: some Scene {

        WindowGroup {

            TalkToMeView()

        }

    }

}

This will set the main view of the app to the TalkToMeView.

  1. Run the app on an iOS simulator or a physical device.

Now you have a basic version of the TalkToMe app using SwiftUI without using a storyboard. You can further customize the UI or add additional features as needed.

Prompt

Remove textfield and always speech “Congratulations! You’ve made your first app.”.Give me whole code again.

Answer

Sure, I’ve modified the code to remove the TextField and always speak “Congratulations! You’ve made your first app." Here’s the updated code:

  1. TalkToMeView.swift:
import SwiftUI

import AVFoundation

struct TalkToMeView: View {

    var body: some View {

        VStack {

            Button(action: {

                speak(text: "Congratulations! You've made your first app.")

            }) {

                Text("Speak")

                    .font(.title)

                    .bold()

                    .padding()

                    .background(Color.blue)

                    .foregroundColor(.white)

                    .cornerRadius(10)

            }

        }

        .padding()

    }

    

    func speak(text: String) {

        let utterance = AVSpeechUtterance(string: text)

        utterance.voice = AVSpeechSynthesisVoice(language: "en-US")

        

        let synthesizer = AVSpeechSynthesizer()

        synthesizer.speak(utterance)

    }

}
  1. YourApp.swift (replace “YourApp" with the actual name of your app):
import SwiftUI

@main

struct YourApp: App {

    var body: some Scene {

        WindowGroup {

            TalkToMeView()

        }

    }

}

Now when you run the app, there will be no TextField, and the app will always speak “Congratulations! You’ve made your first app." when you tap the “Speak" button.

Creating iPhone App with Xcode

Create a Xcode project

Launch Xcode and create an iOS App project named TalkToMe-GPT, with Interface as SwiftUI and Language as Swift.

Paste swift code

Paste the swift code created by GPT-4 into TalkToMe-GPTApp.swift. The code is

import SwiftUI

@main

struct TalkToMe_GPTApp: App {

    var body: some Scene {

        WindowGroup {

            TalkToMeView()

        }

    }

}

Create TalkToMeView.swift file and paste the swift code created by GPT-4. The code is

import SwiftUI

import AVFoundation

struct TalkToMeView: View {

    var body: some View {

        VStack {

            Button(action: {

                speak(text: "Congratulations! You've made your first app.")

            }) {

                Text("Speak")

                    .font(.title)

                    .bold()

                    .padding()

                    .background(Color.blue)

                    .foregroundColor(.white)

                    .cornerRadius(10)

            }

        }

        .padding()

    }

    

    func speak(text: String) {

        let utterance = AVSpeechUtterance(string: text)

        utterance.voice = AVSpeechSynthesisVoice(language: "en-US")

        

        let synthesizer = AVSpeechSynthesizer()

        synthesizer.speak(utterance)

    }

}

Run

The execution result is as shown here. It will talk when “Speak" button is clicked. You can watch the demo video by clicking the mage below.

iPhoneアプリ

We will create an iPhone app that works similarly to the app in the App Inventor 2 Japanese version tutorial using OpenAI’s GPT-4. To create an iPhone app, you need a development environment called Xcode that runs on a Mac. Here, we used Xcode 14.2 on macOS 12.6.3.

Interaction with GPT-4

Prompt

Do you know the App Inventor app called Hello Codi?

Answer

As an AI language model, I’m not able to browse the internet or access new information. As of my last knowledge update in September 2021, I am not familiar with an App Inventor app called “Hello Codi." It’s possible that the app you’re referring to was created after my knowledge was last updated or it’s a lesser-known app.

App Inventor is a visual programming platform developed by MIT that allows users to create apps for Android devices without writing code. Instead, users can build apps using drag-and-drop components and blocks. While there might be many apps built with App Inventor, I can’t provide specific information about “Hello Codi" without further context.

If you can provide more details about the app, I’d be happy to help answer any questions you have based on my general knowledge of App Inventor and mobile app development.

GPT-4 is not familiar with Hello Codi, so consider using a Chrome extension called WebChatGPT. With WebChatGPT, URLs found through internet searches can be provided to GPT-4, allowing it to access more information. The following URLs are given to GPT-4, a tutorial from MIT, a tutorial at github.io, and another tutorial from MIT.

Prompt

Do you know the App Inventor app called Hello Codi?

Answer

Yes, I’m familiar with the HelloCodi app. HelloCodi is a simple app that can be built using MIT App Inventor, a free, cloud-based service that allows you to create your own mobile apps using a block-based programming language [3]. The HelloCodi app involves creating a button with a picture of Codi the bee on it, and programming the button so that when it is clicked, the phone will make a buzzing sound [1]. To build HelloCodi, you’ll need an image file of Codi the bee [1].

Prompt

Can you create an iPhone app that works like Hello Codi?

Answer

While the HelloCodi app is specifically designed for Android using MIT App Inventor, you can create a similar app for iOS devices using an alternative platform like SwiftUI or Xcode, which are Apple’s frameworks for developing iOS applications.

To create an iPhone app that works like HelloCodi, you would need to:

  1. Install Xcode, the integrated development environment (IDE) for iOS development, on a macOS computer.
  2. Learn Swift, Apple’s programming language for iOS app development.
  3. Create a new project in Xcode and design the user interface with a button featuring a picture of Codi the bee.
  4. Add the necessary code in Swift to play a buzzing sound when the button is tapped.

However, if you prefer a more beginner-friendly and visual approach similar to MIT App Inventor, you can try using Thunkable (https://www.thunkable.com/). Thunkable is a drag-and-drop app builder that supports both Android and iOS app development. You can create a HelloCodi-like app for iPhone using Thunkable by designing the user interface and adding the necessary blocks for playing a buzzing sound when the button is tapped.

Prompt

Try creating it using SwiftUI

Answer

To create an iPhone app similar to HelloCodi using SwiftUI, follow these steps:

  1. Install Xcode on a macOS computer if you haven’t already.
  2. Open Xcode and create a new SwiftUI project.
  3. In the project navigator, click on “Assets.xcassets" and add the image of Codi the bee to your project.
  4. Open the ContentView.swift file to edit the user interface and code.

Replace the existing code in ContentView.swift with the following SwiftUI code:

 

Creating iPhone Apps with Xcode

Project Creation

Launch Xcode and create an iOS App project named HelloCodi, with Interface as SwiftUI and Language as Swift.

Adding image and audio files

Add the codi.jpg and Bee-Sound.mp3 files used for the App Inventor version of Hello Codi to the assets.

Paste swift code

Paste the swift code created by GPT-4 into ContentView.swift.

Image files, audio files and ContentView.swift can be downloaded as zip files from here. Please unzip the files after downloading.

Run

The execution result is as shown here. Clicking also produces sound.