Education

RSS for tag

Teach students of all ages to code in Swift using a variety of resources in your curriculum.

Posts under Education tag

113 Posts

Post

Replies

Boosts

Views

Activity

Starting with iOS Dev.
I am starting with programming. I changed career of late. I learnt basics of python very recently. I am keen to work as iOS developer in future. There's ambiguity how to kickstart my journey of programming and app dev. I need suggestion regarding what resources to follow. It's hard to do it without proper and directed guidance. In Book store, I could see books. I downloaded two of them, one is Develop in Swift Fundamentals and the other book is Develop in Swift Explorations. I am confused which one to read first. Is there some other good resources available online? Some YT channel I could refer? Please help me!
3
0
1.3k
Oct ’23
Managed apple ID and Wallet app support
Hi everyone, I'm currently working on implementing some of the discussed ideas, but I've run into an issue. Our company uses managed Apple IDs on all of our iPhones are company-owned. Recently, we updated some of these devices to iOS 17, but we've noticed that the Wallet app is not visible on them. There is no restrictions from our MDM and without the managed Apple ID signed in i can see the app and its usable.
0
2
1.4k
Oct ’23
[Need help!] Performance Issue: Laggy Scroll in SwiftUI App with ScrollView
I'm using ScrollView to display my course list, and each card in the list, named 'CourseCardView' as shown in the code. When I test it on both the simulator and a physical device, I notice that scrolling is not smooth and feels laggy. I'm not sure how to address this issue. Here is my code: // // CourseListView.swift // LexueSwiftUI // // Created by bobh on 2023/9/3. // import SwiftUI struct CourseCardView: View { let cardHeight: CGFloat = 150 let cardCornelRadius: CGFloat = 10 let cardHorizontalPadding: CGFloat = 10 @State var courseName = "course name" @State var courseCategory = "category name" @State var progress = 66 var body: some View { ZStack { Image("default_course_bg2") .resizable() .blur(radius: 5, opaque: true) .cornerRadius(cardCornelRadius) .padding(.horizontal, cardHorizontalPadding) .frame(height: cardHeight) Color.white .cornerRadius(cardCornelRadius) .padding(.horizontal, cardHorizontalPadding) .frame(height: cardHeight) .opacity(0.1) VStack(alignment: .leading, spacing: 2) { Spacer() Text(courseName) .bold() .font(.title) .foregroundColor(.white) .lineLimit(1) .shadow(color: .black.opacity(0.5), radius: 5, x: 0, y: 2) .padding(.leading, 10) Text(courseCategory) .bold() .font(.headline) .foregroundColor(.white) .lineLimit(1) .shadow(color: .black.opacity(0.5), radius: 5, x: 0, y: 2) .padding(.leading, 10) .padding(.bottom, 5) ProgressView(value: Double(progress) / 100.0) .padding(.horizontal, 10) .padding(.bottom, 10) .accentColor(.white) .shadow(color: .black.opacity(0.3), radius: 5, x: 0, y: 2) } .frame(height: cardHeight) .frame(maxWidth: .infinity, alignment: .leading) .padding(.horizontal, cardHorizontalPadding) VStack { HStack { Spacer() Button(action: { }) { Image(systemName: "star") .foregroundColor(.white) .font(.system(size: 24).weight(.regular)) .shadow(color: .black.opacity(0.3), radius: 5, x: 0, y: 2) } .padding(.trailing, 10) .padding(.top, 10) } Spacer() } .frame(height: cardHeight) .frame(maxWidth: .infinity, alignment: .leading) .padding(.horizontal, cardHorizontalPadding) } .shadow(color: .black.opacity(0.3), radius: 5, x: 0, y: 2) } } private struct ListView: View { @Binding var courses: [CourseShortInfo] @Binding var isRefreshing: Bool @Environment(\.refresh) private var refreshAction @ViewBuilder var refreshToolbar: some View { if let doRefresh = refreshAction { if isRefreshing { ProgressView() } else { Button(action: { Task{ await doRefresh() } }) { Image(systemName: "arrow.clockwise") } } } } var body: some View { VStack { ScrollView(.vertical) { LazyVStack(spacing: 20){ ForEach(courses) { item in CourseCardView(courseName: item.shortname!, courseCategory: item.coursecategory!, progress: item.progress!) .listRowSeparator(.hidden) } } } .toolbar { refreshToolbar } } } } struct CourseListView: View { @State private var courseList = GlobalVariables.shared.courseList @State var isRefreshing: Bool = false @State var searchText: String = "" func testRefresh() async { Task { isRefreshing = true Thread.sleep(forTimeInterval: 1.5) withAnimation { isRefreshing = false } } } var body: some View { NavigationView { VStack { ListView(courses: $courseList, isRefreshing: $isRefreshing) .refreshable { print("refresh") await testRefresh() } } .searchable(text: $searchText, prompt: "Search the course") .navigationTitle("Course") .navigationBarTitleDisplayMode(.large) } } } struct CourseListView_Previews: PreviewProvider { static var previews: some View { CourseListView() } } The global variable code: import Foundation import SwiftUI class GlobalVariables { static let shared = GlobalVariables() @Published var isLogin = true @Published var courseList: [CourseShortInfo] = [ CourseShortInfo(id: 11201, shortname: "数据结构与C++程序设计", progress: 66, coursecategory: "自动化学院"), CourseShortInfo(id: 11202, shortname: "数值分析", progress: 20, coursecategory: "数学学院"), CourseShortInfo(id: 11203, shortname: "数据结构与C++程序设计", progress: 66, coursecategory: "自动化学院"), CourseShortInfo(id: 11204, shortname: "数值分析", progress: 20, coursecategory: "数学学院"), CourseShortInfo(id: 11205, shortname: "数据结构与C++程序设计", progress: 66, coursecategory: "自动化学院"), CourseShortInfo(id: 11206, shortname: "数值分析", progress: 20, coursecategory: "数学学院"), CourseShortInfo(id: 11207, shortname: "数据结构与C++程序设计", progress: 66, coursecategory: "自动化学院"), CourseShortInfo(id: 11208, shortname: "数值分析", progress: 20, coursecategory: "数学学院"), CourseShortInfo(id: 11209, shortname: "数据结构与C++程序设计", progress: 66, coursecategory: "自动化学院"), CourseShortInfo(id: 11210, shortname: "数值分析", progress: 20, coursecategory: "数学学院") ] var debugMode = true private init() { } }
1
0
2.4k
Sep ’23
How to make the device supervised with Account-driven Device Enrollment
Hi, Apple Team I'm really excited by a new feature account-driven Device Enrollment, and I tried it soon. The movie says It's available on iOS, iPadOS, and macOS. And just like profile-based Device Enrollment for macOS, it results in the device being Supervised, giving you the highest level of management. And for MDMs, all it takes is a few changes to support it. however my device is still not supervised after the account-driven Device Enrollment flow completes. (My trial is noted in https://zenn.dev/yusukeiwaki/scraps/dacd131de1e966 sorry in Japanese) How can we make the device supervised with account-driven Device Enrollment? Thanks,
1
0
1k
Aug ’23
Need a help
Hi there, I'm studying SwiftUI on my own, but unfortunately I'm still not able to write complex lines of code, or even code an app independently, which is very frustrating for me. I love coding, it's a way to express my creativity. I already have a lot of ideas, but I can't put them into practice because I feel like I don't have learned enough about this programming language. Can any of you suggest me some free courses or other resources that have also helped you in your first steps with coding?
2
0
1.3k
Jul ’23
Desparate to learn Swift coding but there are no places to learn nearby
I would love to learn swift. I live in South Florida, and there doesn't seem to be any places to go to learn swift either in an in-person setting or online class that I can find to be using the latest software. All the online courses i have found are pre recorded and use outdated version of xcode and swift. I am also 43 and work full-time. I want to learn the language and how to build apps as a possible new marketable skill in the future. I can't afford a full blown college admission and I won't take a student loan. I am willing to pay up to a few thousand to get the proper education. Can anyone point me in the right direction. I have minimal exposure to coding. I have tinkered with arduino, and I have an electronics background. Right now i'm following along at https://learn.codewithchris.com/enrollments
1
0
966
Jun ’23
APPLE Staff lying and sying "we tried to call but phone was busy"
Hello, Apple is loosing big time and developers are leaving because of idiots responsible of calling back developers to activite their developer accounts and other idiots working in the App CRAP Store. I am one of those developers and I am sick and tired of those phone operators who where hirede from a shed in some jungle some where in a messed up country that doesnt even have iPhones. I started hating apple products although I have so many of them. Since iPhone 4. Ihave purchased every phone , ipad , watch , computger and lab top for my self , famaily and my employees. I now reached the point fo thinking seriously of abandoning Apple and all its products and start putting every piece I owned on fire every day and post it on every social media. This will be the trend amongst developers leaving Apple and the App Store , for a while and I bet Samsung and other Android products will be happy and support me. I have wasted many years of my life and huge amounts of money buying products and time learing to develop for iCrap , I think it is time to say F IT , it is not worth it , it is time to move to new better tech and better people. Thank you All , it has been misreable being an Apple customer and developer
1
0
1.3k
May ’23
Student ID in Apple Wallet (UK)
For a few years, we have been running a consultation group with our Students for feedback on our Universtity's Student App. Over the past 18 months one of the most requested functions is their Student ID being surfaced in the Apple Wallet. I know this is available at some US institutions, but I can find nothing about this functionality being available in the UK. Has anyone got any info on this? Many Thanks Karl
0
0
902
May ’23
View is not updating while app is running
Hi :-) I´m looking for some help and advice for my little project. Basically I have a Tabview with 3 Tabs. One of them is a View for Favorites. I managed the selection and the saving of the favorites. However, the View for the Favorites is not updating while the app is running. Just when the app is closed and restarted the View of Favorites gets updated. The Array of Favorites is marked with @Published, the variable in the Favorites-View is marked as @ObservedObject. I searched a lot and can't find my mistake. „Expression“ is a Struct with about 10 properties. Class for the Favorites: class Favorites: ObservableObject { @Published var favoriteExpressions: [Expression] = [] { didSet { print("Favorites changed") } } private let saveKey = "FavoriteExpressions" let defaults = UserDefaults.standard init() { if let data = defaults.data(forKey: saveKey) { let decoder = JSONDecoder() if let decoderSet = try? decoder.decode([Expression].self, from: data) { favoriteExpressions = decoderSet } } } func contains() -> Bool { } func add() { } func remove() { } func save() { defaults.set(try? PropertyListEncoder().encode(favoriteExpressions), forKey: saveKey) let encoder = JSONEncoder() if let encodedSet = try? encoder.encode(favoriteExpressions) { defaults.set(encodedSet, forKey: saveKey) } } View for the Favorites struct View_Favoriten: View { @ObservedObject var favoriten = Favorites() var body: some View { ZStack { LinearGradient() ScrollView { LazyVGrid(columns: columns, alignment: .center, spacing: 10) { ForEach(favoriten.favoriteExpressions.sorted(), id: \.self ) { expression in VStack{ code for displaying data } .environmentObject(favoriten) } } .padding(20) } } .navigationBarHidden(false) } .accentColor(.accentColor) } The TabView: struct ContentView: View { var body: some View { TabView { View_Thema(expressions: Data) .tabItem { Image() } View_Favoriten() .tabItem { Image() } .environmentObject(Favorites()) Info_View() .tabItem { Image() } } .environmentObject(Favorites()) } } You may observe that I’m saving the entire Expressions, instead of a key value. Previously i used to do that, but I suspected the calculated property (for getting the Structs related to the key value) maybe prohibiting the update of the View, therefore I’ve saved the entire Struct of Expression in an Array. Thank you in advance! Cheers, Saxa
2
1
1.2k
May ’23
merchant validaton - via Java
Hi,Has anyone successfully done a merchant validation via java servlet using the merchant identity cert and private key?If so, please share your code.I have been googling this topic for hours and it doesn't seem like anyone has done this or can explain how to odo it.thanks
1
0
1.8k
Apr ’23
Will .swiftpm file work in iPad playgrounds file if made in Xcode ?
Hi everyone, I've made a project in Xcode app playground project (.swiftpm) I have an AR component in my app which I've tested on an iPhone where it works fine but as the submission are only judged on either the iPads or the Macs. Since my app has an AR functionality so my will only be judged on an iPad. Unfortunately I don't have an access to an iPad. I'm worried that will this project of mine even work on an iPad because I've never used an iPad's playground before. If anyone has an experience that a swift app playground project made with Xcode will build and run on an iPad's swift playground please do let me know. Although I've adjusted my app to look and work great on an iPad as well. Thank you!!
1
0
1.3k
Apr ’23
Bundle.main.url/path cannot locate audio file.
Hii, I wanted to use some audio files for my project that I'm building for Swift Student Challenge. But when I'm trying to locate the audio file I get an error or crash because the playground cannot locate or find the path to that audio file. I'm using Xcode app playground project. My code : func playSound(soundName:String){ if let url = Bundle.main.url(forResource: "CFile", withExtension: "mp3"){ do { self.audioPlayer = try AVAudioPlayer(contentsOf: url) self.audioPlayer?.prepareToPlay() self.audioPlayer?.play() }catch { print("Error : \(error)") } } else{ print("ERROR") } // let url = Bundle.main.url(forResource: "C", withExtension: "wav") // audioPlayer = try! AVAudioPlayer(contentsOf: url!) // self.audioPlayer.play() } } If anyone has a solution please help me to fix this thing because sound is an important part of my project. Thank you!!!
1
0
1.6k
Apr ’23
Starting with iOS Dev.
I am starting with programming. I changed career of late. I learnt basics of python very recently. I am keen to work as iOS developer in future. There's ambiguity how to kickstart my journey of programming and app dev. I need suggestion regarding what resources to follow. It's hard to do it without proper and directed guidance. In Book store, I could see books. I downloaded two of them, one is Develop in Swift Fundamentals and the other book is Develop in Swift Explorations. I am confused which one to read first. Is there some other good resources available online? Some YT channel I could refer? Please help me!
Replies
3
Boosts
0
Views
1.3k
Activity
Oct ’23
Managed apple ID and Wallet app support
Hi everyone, I'm currently working on implementing some of the discussed ideas, but I've run into an issue. Our company uses managed Apple IDs on all of our iPhones are company-owned. Recently, we updated some of these devices to iOS 17, but we've noticed that the Wallet app is not visible on them. There is no restrictions from our MDM and without the managed Apple ID signed in i can see the app and its usable.
Replies
0
Boosts
2
Views
1.4k
Activity
Oct ’23
Older Computer that will run XCode 15
What is an older computer that I can get that will still run XCode 15. I would like to start teaching my 9 year old grandson programming. My budget is limited. We are also looking to create a programming club at the local high school Thank you for any help you can give.
Replies
0
Boosts
0
Views
840
Activity
Oct ’23
Where do I download the Playgrounds folder for the Intro to Swift?
This may be a dumb question but I cannot find the 'Playgroundbasics.playground' file nor the folder where i am supposed to download it?I am following the Introduction to Swift and I am on Lesson 1 trying to figure out where to find this folder to download.thank you for the help!
Replies
4
Boosts
1
Views
3.7k
Activity
Sep ’23
[Need help!] Performance Issue: Laggy Scroll in SwiftUI App with ScrollView
I'm using ScrollView to display my course list, and each card in the list, named 'CourseCardView' as shown in the code. When I test it on both the simulator and a physical device, I notice that scrolling is not smooth and feels laggy. I'm not sure how to address this issue. Here is my code: // // CourseListView.swift // LexueSwiftUI // // Created by bobh on 2023/9/3. // import SwiftUI struct CourseCardView: View { let cardHeight: CGFloat = 150 let cardCornelRadius: CGFloat = 10 let cardHorizontalPadding: CGFloat = 10 @State var courseName = "course name" @State var courseCategory = "category name" @State var progress = 66 var body: some View { ZStack { Image("default_course_bg2") .resizable() .blur(radius: 5, opaque: true) .cornerRadius(cardCornelRadius) .padding(.horizontal, cardHorizontalPadding) .frame(height: cardHeight) Color.white .cornerRadius(cardCornelRadius) .padding(.horizontal, cardHorizontalPadding) .frame(height: cardHeight) .opacity(0.1) VStack(alignment: .leading, spacing: 2) { Spacer() Text(courseName) .bold() .font(.title) .foregroundColor(.white) .lineLimit(1) .shadow(color: .black.opacity(0.5), radius: 5, x: 0, y: 2) .padding(.leading, 10) Text(courseCategory) .bold() .font(.headline) .foregroundColor(.white) .lineLimit(1) .shadow(color: .black.opacity(0.5), radius: 5, x: 0, y: 2) .padding(.leading, 10) .padding(.bottom, 5) ProgressView(value: Double(progress) / 100.0) .padding(.horizontal, 10) .padding(.bottom, 10) .accentColor(.white) .shadow(color: .black.opacity(0.3), radius: 5, x: 0, y: 2) } .frame(height: cardHeight) .frame(maxWidth: .infinity, alignment: .leading) .padding(.horizontal, cardHorizontalPadding) VStack { HStack { Spacer() Button(action: { }) { Image(systemName: "star") .foregroundColor(.white) .font(.system(size: 24).weight(.regular)) .shadow(color: .black.opacity(0.3), radius: 5, x: 0, y: 2) } .padding(.trailing, 10) .padding(.top, 10) } Spacer() } .frame(height: cardHeight) .frame(maxWidth: .infinity, alignment: .leading) .padding(.horizontal, cardHorizontalPadding) } .shadow(color: .black.opacity(0.3), radius: 5, x: 0, y: 2) } } private struct ListView: View { @Binding var courses: [CourseShortInfo] @Binding var isRefreshing: Bool @Environment(\.refresh) private var refreshAction @ViewBuilder var refreshToolbar: some View { if let doRefresh = refreshAction { if isRefreshing { ProgressView() } else { Button(action: { Task{ await doRefresh() } }) { Image(systemName: "arrow.clockwise") } } } } var body: some View { VStack { ScrollView(.vertical) { LazyVStack(spacing: 20){ ForEach(courses) { item in CourseCardView(courseName: item.shortname!, courseCategory: item.coursecategory!, progress: item.progress!) .listRowSeparator(.hidden) } } } .toolbar { refreshToolbar } } } } struct CourseListView: View { @State private var courseList = GlobalVariables.shared.courseList @State var isRefreshing: Bool = false @State var searchText: String = "" func testRefresh() async { Task { isRefreshing = true Thread.sleep(forTimeInterval: 1.5) withAnimation { isRefreshing = false } } } var body: some View { NavigationView { VStack { ListView(courses: $courseList, isRefreshing: $isRefreshing) .refreshable { print("refresh") await testRefresh() } } .searchable(text: $searchText, prompt: "Search the course") .navigationTitle("Course") .navigationBarTitleDisplayMode(.large) } } } struct CourseListView_Previews: PreviewProvider { static var previews: some View { CourseListView() } } The global variable code: import Foundation import SwiftUI class GlobalVariables { static let shared = GlobalVariables() @Published var isLogin = true @Published var courseList: [CourseShortInfo] = [ CourseShortInfo(id: 11201, shortname: "数据结构与C++程序设计", progress: 66, coursecategory: "自动化学院"), CourseShortInfo(id: 11202, shortname: "数值分析", progress: 20, coursecategory: "数学学院"), CourseShortInfo(id: 11203, shortname: "数据结构与C++程序设计", progress: 66, coursecategory: "自动化学院"), CourseShortInfo(id: 11204, shortname: "数值分析", progress: 20, coursecategory: "数学学院"), CourseShortInfo(id: 11205, shortname: "数据结构与C++程序设计", progress: 66, coursecategory: "自动化学院"), CourseShortInfo(id: 11206, shortname: "数值分析", progress: 20, coursecategory: "数学学院"), CourseShortInfo(id: 11207, shortname: "数据结构与C++程序设计", progress: 66, coursecategory: "自动化学院"), CourseShortInfo(id: 11208, shortname: "数值分析", progress: 20, coursecategory: "数学学院"), CourseShortInfo(id: 11209, shortname: "数据结构与C++程序设计", progress: 66, coursecategory: "自动化学院"), CourseShortInfo(id: 11210, shortname: "数值分析", progress: 20, coursecategory: "数学学院") ] var debugMode = true private init() { } }
Replies
1
Boosts
0
Views
2.4k
Activity
Sep ’23
iMessages sync and backup using a managed ID
Hi, Im testing protecting iMessages using an managed ID with iOS 16.6. With a managed ID, it seems iMessages sycned to iClould is not available nor are iMessages backed up using the backup option on the device. When is this feature expected to be available? Thanks, Mohsin
Replies
1
Boosts
0
Views
809
Activity
Aug ’23
How to make the device supervised with Account-driven Device Enrollment
Hi, Apple Team I'm really excited by a new feature account-driven Device Enrollment, and I tried it soon. The movie says It's available on iOS, iPadOS, and macOS. And just like profile-based Device Enrollment for macOS, it results in the device being Supervised, giving you the highest level of management. And for MDMs, all it takes is a few changes to support it. however my device is still not supervised after the account-driven Device Enrollment flow completes. (My trial is noted in https://zenn.dev/yusukeiwaki/scraps/dacd131de1e966 sorry in Japanese) How can we make the device supervised with account-driven Device Enrollment? Thanks,
Replies
1
Boosts
0
Views
1k
Activity
Aug ’23
Multiple SwiftUI Views in Swift Playgrounds
Hello, i am working on my project for the Swift Student Challenge and it came to my attention that the project must be built using Swift Playgrounds. I have run into an issue where I want to add multiple views to my project but it seems i am unable. How am i supposed to do this?
Replies
1
Boosts
0
Views
1.4k
Activity
Aug ’23
Need a help
Hi there, I'm studying SwiftUI on my own, but unfortunately I'm still not able to write complex lines of code, or even code an app independently, which is very frustrating for me. I love coding, it's a way to express my creativity. I already have a lot of ideas, but I can't put them into practice because I feel like I don't have learned enough about this programming language. Can any of you suggest me some free courses or other resources that have also helped you in your first steps with coding?
Replies
2
Boosts
0
Views
1.3k
Activity
Jul ’23
Desparate to learn Swift coding but there are no places to learn nearby
I would love to learn swift. I live in South Florida, and there doesn't seem to be any places to go to learn swift either in an in-person setting or online class that I can find to be using the latest software. All the online courses i have found are pre recorded and use outdated version of xcode and swift. I am also 43 and work full-time. I want to learn the language and how to build apps as a possible new marketable skill in the future. I can't afford a full blown college admission and I won't take a student loan. I am willing to pay up to a few thousand to get the proper education. Can anyone point me in the right direction. I have minimal exposure to coding. I have tinkered with arduino, and I have an electronics background. Right now i'm following along at https://learn.codewithchris.com/enrollments
Replies
1
Boosts
0
Views
966
Activity
Jun ’23
APPLE Staff lying and sying "we tried to call but phone was busy"
Hello, Apple is loosing big time and developers are leaving because of idiots responsible of calling back developers to activite their developer accounts and other idiots working in the App CRAP Store. I am one of those developers and I am sick and tired of those phone operators who where hirede from a shed in some jungle some where in a messed up country that doesnt even have iPhones. I started hating apple products although I have so many of them. Since iPhone 4. Ihave purchased every phone , ipad , watch , computger and lab top for my self , famaily and my employees. I now reached the point fo thinking seriously of abandoning Apple and all its products and start putting every piece I owned on fire every day and post it on every social media. This will be the trend amongst developers leaving Apple and the App Store , for a while and I bet Samsung and other Android products will be happy and support me. I have wasted many years of my life and huge amounts of money buying products and time learing to develop for iCrap , I think it is time to say F IT , it is not worth it , it is time to move to new better tech and better people. Thank you All , it has been misreable being an Apple customer and developer
Replies
1
Boosts
0
Views
1.3k
Activity
May ’23
Student ID in Apple Wallet (UK)
For a few years, we have been running a consultation group with our Students for feedback on our Universtity's Student App. Over the past 18 months one of the most requested functions is their Student ID being surfaced in the Apple Wallet. I know this is available at some US institutions, but I can find nothing about this functionality being available in the UK. Has anyone got any info on this? Many Thanks Karl
Replies
0
Boosts
0
Views
902
Activity
May ’23
Help, I need to save an object in CoreData
Hi, I am trying to save and retrieve an object in coredata with the following attributes: id, classification de tipo String, values de tipo [(Double, Double)], but I don't know how to save values:[(Double, Double)]. Thanks, greetings.
Replies
1
Boosts
0
Views
1.1k
Activity
May ’23
View is not updating while app is running
Hi :-) I´m looking for some help and advice for my little project. Basically I have a Tabview with 3 Tabs. One of them is a View for Favorites. I managed the selection and the saving of the favorites. However, the View for the Favorites is not updating while the app is running. Just when the app is closed and restarted the View of Favorites gets updated. The Array of Favorites is marked with @Published, the variable in the Favorites-View is marked as @ObservedObject. I searched a lot and can't find my mistake. „Expression“ is a Struct with about 10 properties. Class for the Favorites: class Favorites: ObservableObject { @Published var favoriteExpressions: [Expression] = [] { didSet { print("Favorites changed") } } private let saveKey = "FavoriteExpressions" let defaults = UserDefaults.standard init() { if let data = defaults.data(forKey: saveKey) { let decoder = JSONDecoder() if let decoderSet = try? decoder.decode([Expression].self, from: data) { favoriteExpressions = decoderSet } } } func contains() -> Bool { } func add() { } func remove() { } func save() { defaults.set(try? PropertyListEncoder().encode(favoriteExpressions), forKey: saveKey) let encoder = JSONEncoder() if let encodedSet = try? encoder.encode(favoriteExpressions) { defaults.set(encodedSet, forKey: saveKey) } } View for the Favorites struct View_Favoriten: View { @ObservedObject var favoriten = Favorites() var body: some View { ZStack { LinearGradient() ScrollView { LazyVGrid(columns: columns, alignment: .center, spacing: 10) { ForEach(favoriten.favoriteExpressions.sorted(), id: \.self ) { expression in VStack{ code for displaying data } .environmentObject(favoriten) } } .padding(20) } } .navigationBarHidden(false) } .accentColor(.accentColor) } The TabView: struct ContentView: View { var body: some View { TabView { View_Thema(expressions: Data) .tabItem { Image() } View_Favoriten() .tabItem { Image() } .environmentObject(Favorites()) Info_View() .tabItem { Image() } } .environmentObject(Favorites()) } } You may observe that I’m saving the entire Expressions, instead of a key value. Previously i used to do that, but I suspected the calculated property (for getting the Structs related to the key value) maybe prohibiting the update of the View, therefore I’ve saved the entire Struct of Expression in an Array. Thank you in advance! Cheers, Saxa
Replies
2
Boosts
1
Views
1.2k
Activity
May ’23
About using SwiftUI charge
I want to use SwiftUI on me journal or paper.so I want to know what kind of extra fee will be charged.
Replies
1
Boosts
0
Views
968
Activity
May ’23
merchant validaton - via Java
Hi,Has anyone successfully done a merchant validation via java servlet using the merchant identity cert and private key?If so, please share your code.I have been googling this topic for hours and it doesn't seem like anyone has done this or can explain how to odo it.thanks
Replies
1
Boosts
0
Views
1.8k
Activity
Apr ’23
Will .swiftpm file work in iPad playgrounds file if made in Xcode ?
Hi everyone, I've made a project in Xcode app playground project (.swiftpm) I have an AR component in my app which I've tested on an iPhone where it works fine but as the submission are only judged on either the iPads or the Macs. Since my app has an AR functionality so my will only be judged on an iPad. Unfortunately I don't have an access to an iPad. I'm worried that will this project of mine even work on an iPad because I've never used an iPad's playground before. If anyone has an experience that a swift app playground project made with Xcode will build and run on an iPad's swift playground please do let me know. Although I've adjusted my app to look and work great on an iPad as well. Thank you!!
Replies
1
Boosts
0
Views
1.3k
Activity
Apr ’23
Bundle.main.url/path cannot locate audio file.
Hii, I wanted to use some audio files for my project that I'm building for Swift Student Challenge. But when I'm trying to locate the audio file I get an error or crash because the playground cannot locate or find the path to that audio file. I'm using Xcode app playground project. My code : func playSound(soundName:String){ if let url = Bundle.main.url(forResource: "CFile", withExtension: "mp3"){ do { self.audioPlayer = try AVAudioPlayer(contentsOf: url) self.audioPlayer?.prepareToPlay() self.audioPlayer?.play() }catch { print("Error : \(error)") } } else{ print("ERROR") } // let url = Bundle.main.url(forResource: "C", withExtension: "wav") // audioPlayer = try! AVAudioPlayer(contentsOf: url!) // self.audioPlayer.play() } } If anyone has a solution please help me to fix this thing because sound is an important part of my project. Thank you!!!
Replies
1
Boosts
0
Views
1.6k
Activity
Apr ’23
How can I watch the WWDC video in Apple TV?
Hi,Is it possible to watch the WWDC developer video in Apple TV directly, currently, I need to download to watch the video, it's a little in-convenient.Does anybody know how to do it?
Replies
2
Boosts
0
Views
1.9k
Activity
Apr ’23
What format should i use? storyboard/playground? And FIGMA use?
Hey, I am new in xcode and i wanted to knows that for WWDC23 which format should i click on IOS apps and then storyboard or Swift playground? secondly can i use FIGMA to make my UI design and implement it and make it responsive or i have to make it solely in xcode?? Thanks
Replies
1
Boosts
1
Views
642
Activity
Apr ’23