Group Group Group Group Group Group Group Group Group

Your First iOS and SwiftUI App | raywenderlich.com

If you're a complete beginner to iOS and SwiftUI development and wondering how to get started, this is the course for you.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/4919757-your-first-ios-and-swiftui-app

Hi Ray! Are there another (e-mail, text) versions of this and another courses?

Hi Joe - if you want this course in text form, check out our book the iOS Apprentice. The early access version of the 8th edition, which includes the content from this course in text form, is out today! :]

Hi Ray!

I’ve done lessons 1-46, so I’ve got a working app but for some reason on my phone (iPhone SE) the buttons aren’t displayed correctly like in the simulator. They have the right shape but they’re the ‘midnightBlue’ colour. I’ve checked if that’s also the case with your app to check if it was my mistake but it’s also a problem with your app. Everything else but that is fine. Have you got an idea why it’s happening and how to fix it? I’ve got all the updates on both my mac and iPhone. Stackoverflow didn’t really help.

Thanks in advance!


Edit: found a solution on this website:

https://www.hackingwithswift.com/quick-start/swiftui/how-to-disable-the-overlay-color-for-images-inside-button-and-navigationlink

Just need to add this line:

.buttonStyle(PlainButtonStyle())

to the Button

@kammahha Thank you for sharing your solution - much appreciated! :]

I ran the Bullseye project on the simulator and noticed that the Info button only works the first time you press it. Afterwards it does nothing. I checked it on my phone and it works as expected so the problem is with the simulator.
I tried this on another I am writing and ran into the same problem.
Do you know if there is a way to get the simulator to work correctly?
Thanks!

@dianehoff Do you still have issues with this?

Hi,
Last time I checked (last week) it had the problem. But I have moved on to other projects and have not looked at it recently. Do you know if anyone else saw a similar issue or could it be an issue with my computer?

Thanks,
Diane

Diane - I am having the same problem.

I am having strange issue before .padding worked but when I added navigationBarTitle the padding gives "“Int: is not Convertible to 'CGFloat?”

Here is part of the code:
.padding(.bottom, 20)
}
.background(Image(“Background”), alignment: .center)
.accentColor(midnightBlue)
.navigationBarTitle(“Bullseye”)

If I remove padding from the code then the error goes to:
Text("(self.target)").modifier(ValueStyle())

Error says: Type of expression is ambiguous without more context. I tried removing self but still has a error

Hi there! My name is Nikita. I’m from Russia. In my opinion, this course is awesome. The first app on the first course, wow! To be honest, my English is not very good, but I understand almost everything. I will be happy to recommend this course to my friends. Thanks Ray!

A conversation over on Stack Overflow indicates that this is a bug fixed in v11.4 of Xcode.

@tyfightercode Do you still have issues with this?

@niketracer Really glad you enjoy it! Cheers! :]

Ray, I have a question.
In the app you defined a custom view modifier struct called LabelStyle .
struct LabelStyle : ViewModifier {
func body(content: Content) -> some View {
return content.foregroundColor(Color.white)
.shadow(color: Color.black, radius: 5, x: 2, y: 2)
.font(Font.custom(“Arial Rounded MT Bold”, size: 18))
}
}

After that you used this LabelStyle to style/modify the text like below. You created an instance of LabelStyle() and pass it s an argument to modifier function
HStack {
Text(“Put the bullseye as close as you can to:”).modifier( LabelStyle() )
Text("(target)")
}
Generally I get all of these but there are a few things I want to understand.

1- In the LabelStyle struct we wrote body function and this function is doing all the styling work and returns the styled view. However when we use LableStyle we only created a instance of it and passed it to modifier function(.modifier( LabelStyle() )). We never called body method for the instance we created. How/when/where this body method is called? Could you please explain this with an example?

2- Could we call this body method manually and style a text instead of using modifier method? Is so please could you example?

Thanks

With the new swiftUI 2.0 there is a new app structure I got all the way to adding the info page and I have no app delegate… so I guess I lucked out… was close to getting it finished…

Hi Ray! I just finished Your First iOS and SwiftUI App, but when I tried to run the app on my iPhone 8 Plus, I encounter some layout problems, it looks like the app doesn’t really fit on the screen of my phone. There is such a way to create app with an auto layout? On the subscriber tutorials I will performe this kind of issue?
Thanks!!