Post not yet marked as solved
Apple has a "Develop in Swift" curriculum with three books available at
https://developer.apple.com/learn/curriculum/. However, they link to Apple Books, which isn't available in China. Is there any possible way to download an English copy of it without going through Books? Thanks!
Post not yet marked as solved
I created a swiftpm project with Xcode Version 13.4.1 (13F100).
I changed the target from the default created by Xcode to this:
targets: [
.executableTarget(
name: "App",
path: "App"
)
]
I also changed the package version to 5.6 to match the AboutMe Package file.
I also created an App directory and moved all my files (bar the Package.swift file) to it, and I also created a Guide folder and created a Guide.tutorial file based on the example in the WWDC video.
I've turned on Author Debugging Mode (this is on Swift Playgrounds on the Mac, I'll try later on Swift Playgrounds on the iPad), but I get no messages other than the "Could not display guide. Try reopening the current project..."
I also get a build error that just says "Building failed"
What am I missing?
Post not yet marked as solved
I'm looking for the Swift tutorial that had always been used since I started learning Swift for the first time about 5 years ago. I can't remember the name. It was an app that reviewed restaurants, as I remember. I need a sample of key-value-coding. I recall that tutorial used key-value-coding.
Post not yet marked as solved
Is there a logical disjunction operator or function in Swift?
Even better, is there a logical disjunction that works with optional variables instead of boolean variables that returns an object when true, and returns nil when false?
A logical disjunction evaluates two boolean variables, and if at least one of them is true, then the return value is true. If neither variables is true, then the return value is false.
Post not yet marked as solved
I am 14 years old and would like to participate in the Swift Student Challenge @ WWDC23. I have no experience programming in Swift or any other programming language. What do you suggest to learn Swift?
Post not yet marked as solved
Hi I heard about WWDC2 and I interested in it. I decided to start Swift but I don’t know from where can I start? Can anyone guide me ? Which source should I use ? And I want to prepare myself for next year WWDC .
Thanks :)
Post not yet marked as solved
If you grossed over $20,000 (or 200 sales) in sales from Apple you will receive a 1099-K.There are 2 problems with this:1) This will NOT reflect the 30% that Apple has withheld.2) A 1099-K will only be sent for those regions that meet the criteria for Apple issuing a 1099-K. Thus, this won't reflect all of your sales. Note: this is an assumption as I had more sales then this 1099-K reflects. In my case, I only received a 1099-K for US sales (I assume as it doesn't say). As a result, the difference from what the 1099k is reporting and what I actually received is only 12%, not 30%. That is, for example, the 1099-K says that I had$20,000 in sales, but what was actually deposited in my account was $17,600.How did you guys/gals fortunate/unfortunate enough to receive a 1099-K report this on your taxes?Did you, for example, have:a) 1099-K income of $20,000 with a business expense of 30% = $14,000b) Addional non-reported income of ($17,600-$14,000) = $3600Total: $17,600 (amount actually received from Apple sales)-OR-a) 1099-K income of $20,000 with a business expense of 12% = $17,600Thanks for the help with this!
Post not yet marked as solved
Hi, does anyone know how to access buttons through a different view controller in Xcode? For example, in firstViewController I placed a button that is disabled, but once the user presses the button in the secondViewController, the button in firstViewController becomes enabled.
Post not yet marked as solved
Hello, I've been attempting to generate this code, but the last line returns an Expected declaration Error.
class AboutMe {
let firstName: String
let lastName: String
let age: Int
init(firstName: String, lastName: String, age: Int){
self.firstName = firstName
self.lastName = lastName
self.age = age
}
var me: String {
return "First Name: \(firstName), / Last Name: \(lastName), / Age: \(age)"
}
let myInfo = AboutMe(firstName: "NAME", lastName: "NAME", age: 10)
print(myInfo)
}
Post not yet marked as solved
When I go to my terminal and type in "python" or "python --version" I get back "command not found: python"
I have the newest version downloaded but not even version 2 isn't showing up. What do I do?
I even just factory reset my mac. I'm running the M1 mini
Hello all,
I was wondering in the Swift Student Challenge requirements, it states: All content should be in English. What if my game is mainly in English (UI, main content,) but some foreign language (glyph to be specific) is used as part of app. The judge should be able to use the app without any fluency other than English. Will including some foreign language disqualify my entry?
Thank you so much for answering my question.
Nico
Post not yet marked as solved
In addition to this year's 2022 award mentioned on the website, does Apple pay for student admission and accommodation?
Post not yet marked as solved
As you prepare your students for a future driven by technology, teaching them how to code is critical. It opens new doors to potential careers and helps prepare them for college. Starting this school year students can earn App Development with Swift certification through Certiport based on the free App Development with Swift course from Apple. Level 1 certification recognizes knowledge of the Swift programming language, app developer tools, and core components of apps, and can be offered by any Certiport Authorized Testing Center that has purchased access to it.* Students who pass the exam will earn a digital badge to showcase their achievement on a resume, portfolio, email signature, or career networking site.Learn more about App Development with Swift certification at Certiport.com >*Additional terms may apply; see the Certiport website for more information.
Posted
by
Apple Staff.
Last updated
.
Post not yet marked as solved
Something wrong with Readline. I can't use
readLine()!)!
My code is really simple:
var aYear = Int(readLine()!)!
func isLeap(year: Int) {
var leap = "NO"
//IF divisible by 4 with no remainders.
if year % 4 == 0 {
leap = "YES"
//Is leap year, unless:
}
if year % 100 == 0 {
leap = "NO"
//Is not leap year, unless:
}
if year % 400 == 0 {
leap = "YES"
//Is leap year.
}
print(leap)
}
//Don't change this
isLeap(year: aYear)
This error keeps coming up. I can't figure out how to fix this error:
"__lldb_expr_122/readline .playground:1: Fatal error: Unexpectedly found nil while unwrapping an Optional value
Playground execution failed:
error: Execution was interrupted, reason: EXC_BREAKPOINT (code=1, subcode=0x18f494588).
The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation."
It is really strange because in online compiler this simple code works just fine.
PLEASE HELP ME. I CAN'T FIND THE SOLUTION.
It's kinda internal xcode error or what...
Post not yet marked as solved
This is the content view which moves down on the screen as I open it from different view.
when I click top left button to open menu.
The menu
When I click the Home option from menu whole view moves down on screen.
The whole view gets moved down on screen each time I open it.
//the content view
import SwiftUI
struct ContentView: View {
var body: some View {
NavigationView{
ScrollView{
Text("Men")
.font(.system(size: 30, weight:.bold))
.padding(.trailing, 320.0)
ScrollView(.horizontal){
HStack{
NavigationLink(destination:mentshirt()){
custom(content:Image("mentshirt"),over:"T-shirt",col: .black)
}
NavigationLink(destination:menjeans()){
custom(content:Image("menjeans"),over:"Jeans",col: .black)
}
NavigationLink(destination:menjacket()){
custom(content:Image("menjacket"),over: "Jacket",col: .black)
}
}
}
Text("Women")
.font(.system(size: 30,weight: .bold))
.padding(.trailing,280.0)
ScrollView(.horizontal){
HStack{
NavigationLink(destination:womentshirt()){
custom(content:Image("womentshirt"),over:"T-shirt",col: .black)
}
NavigationLink(destination:womenjeans()){
custom(content:Image("womenjeans"),over:"Jeans",col: .black)
}
NavigationLink(destination:womenjacket()){
custom(content:Image("womenjacket"),over:"Jacket",col: .black)
}
}
}
Text("Kids")
.font(.system(size: 30,weight: .bold))
.padding(.trailing,320.0)
ScrollView(.horizontal){
HStack{
NavigationLink(destination:kidtshirt()){
custom(content:Image("kidtshirt"),over:"T-shirt",col:.black)
}
NavigationLink(destination:kidjeans()){
custom(content:Image("kidjeans"),over:"Jeans",col: .black)
}
NavigationLink(destination:kidjacket()){
custom(content:Image("kidjacket"),over:"Jacket",col:.black)
}
}
}
}
.navigationBarBackButtonHidden(true)
.navigationBarItems(leading:
NavigationLink(
destination: clothlist()){
navcustom(content:
Image(systemName: "line.horizontal.3"),col: .white)
},
trailing:
HStack{
Image("logo")
.resizable()
.clipShape(Circle())
.shadow(color:.white,radius: 10)
.frame(width: 30, height: 30, alignment: .center)
Spacer(minLength: 80)
NavigationLink(destination: cart()){
navcustom(content:
Image(systemName: "cart"),col: .white)
}
Spacer(minLength: 15)
NavigationLink(destination: login()){
navcustom(content:Image(systemName: "person.crop.circle.fill"), col: .white)
}
}
)
}.navigationBarBackButtonHidden(true)
.ignoresSafeArea()
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
Group {
ContentView()
.environment(\.colorScheme, .dark)
}
}
}
func custom(content:Image,over:String,col:Color) -> some View {
content
.resizable()
.overlay(Text(over).font(.system(size: 20,weight: .bold)).foregroundColor(col),alignment: .bottomLeading)
.frame(width: 400, height: 500, alignment: .center)
.padding(5)
}
func navcustom(content:Image,col:Color)-> some View {
content
.resizable()
.frame(width: 30, height: 30, alignment: .center)
.foregroundColor(col)
}
//the menu view from which I open content view
import SwiftUI
struct clothlist: View {
var body: some View {
List
{
NavigationLink(destination:ContentView())
{
Text(Image(systemName: "house"))+Text(" Home")
}
Text(Image(systemName: "person"))+Text(" Men")
NavigationLink(destination:menjeans())
{
Text("Jeans")
}
NavigationLink(destination:menjacket())
{
Text("Jacket")
}
NavigationLink(destination:mentshirt())
{
Text("Tshirt")
}
Text(Image(systemName: "person"))+Text(" Women")
NavigationLink(destination:womenjeans())
{
Text("Jeans")
}
NavigationLink(destination:womenjacket())
{
Text("Jacket")
}
NavigationLink(destination:womentshirt())
{
Text("Tshirt")
}
Group{
Text(Image(systemName: "person"))+Text(" Kids")
NavigationLink(destination:kidjeans())
{
Text("Jeans")
}
NavigationLink(destination:kidjacket())
{
Text("Jacket")
}
NavigationLink(destination:kidtshirt())
{
Text("Tshirt")
}
}
}
.navigationBarBackButtonHidden(true)
}
}
struct clothlist_Previews: PreviewProvider {
static var previews: some View {
clothlist()
}
}
how to stop the view from moving down on screen on every open?
Post not yet marked as solved
Hi friends. I'm new around here and just migrated from Windows to macOS. I started working on iOS development with Swift. So if you have any study resource suggestions for beginners, can you share them? I am open to all resources such as documents, websites, videos.
Post not yet marked as solved
I want the details entered in textfield and password should stay even after changing the view or closing the app and the person should be logged in even after he closes the app, Can anyone help me out?
import SwiftUI
import Firebase
struct login: View {
@State var chec:String=""
@State var email:String=""
@State var navigated = false
@State var loggedin:Bool=false
@State var pass:String=""
@State private var secured:Bool=true
var body: some View
{
VStack
{
if(loggedin==true)
{
Image("logo")
.resizable()
.clipShape(Circle())
.shadow(color:.green,radius: 10)
.frame(width: 200, height: 200, alignment: .center)
}
else
{
Image("logo")
.resizable()
.clipShape(Circle())
.shadow(color:.red,radius: 10)
.frame(width: 200, height: 200, alignment: .center)
}
Spacer(minLength: 50.0)
Text(chec)
.foregroundColor(.red)
HStack
{
Text("E-mail:")
TextField("", text:$email)
.foregroundColor(.white)
.frame(width: 275)
.textFieldStyle(.roundedBorder)
.autocapitalization(.none)
.disableAutocorrection(true)
}
HStack
{
Text("Password:")
if secured
{
SecureField("",text:$pass)
.background(Color.black)
.foregroundColor(.white)
.textFieldStyle(.roundedBorder)
.autocapitalization(.none)
.disableAutocorrection(true)
}
else
{
TextField("",text: $pass)
.background(Color.black)
.foregroundColor(.white)
.textFieldStyle(.roundedBorder)
.autocapitalization(.none)
.disableAutocorrection(true)
}
Button(action: {self.secured.toggle()})
{
if secured
{
Image(systemName:"eye.slash")
}
else
{
Image(systemName:"eye")
}
}.buttonStyle(BorderlessButtonStyle())
}
VStack{
Button(action: {
if(email==""&&pass=="")
{
chec="Enter E-mail and Password"
}
else if(pass=="")
{
chec="Enter Password"
}
else if(email=="")
{
chec="Enter E-mail"
}
guard !email.isEmpty,!pass.isEmpty else
{
return
}
loginfunc()
}){
Text("Login")
}
NavigationLink(destination: signup(),label:{Text("Not Yet signed? Create new account")})
.padding(.top, 3.0)
}
.padding()
Spacer(minLength: 400)
}
}
func loginfunc(){
Auth.auth().signIn(withEmail: email, password: pass) { result, error in
if error != nil{
print(error?.localizedDescription ?? "")
loggedin=false
chec="E-mail or Password wrong!"
}else {
print("success")
loggedin=true
}
if(loggedin==true)
{
chec=""
print("wow so nice to get work done")
}
}
}
}
//}
struct ButtonView: View {
var buttext:String
var body: some View {
Text(buttext)
.frame(width: 200, height: 100, alignment: .center)
.background(Color.black)
.foregroundColor(Color.white)
}
}
struct login_Previews: PreviewProvider {
static var previews: some View {
login()
.environment(\.colorScheme, .dark)
}
}
Post not yet marked as solved
import SwiftUI
struct lastview: View {
var img:UIImage
var texty:String
var body: some View {
ScrollView(.vertical){
Image(uiImage: img)
.resizable()
.frame(width: 500, height: 500, alignment: .center)
Text(texty)
.multilineTextAlignment(.leading)
}
}
}
Post not yet marked as solved
Hi guys I want to participate in the Swift Student Challenge this year. Any suggestions on how to prepare for it?