Post

Replies

Boosts

Views

Activity

Reply to "Cannot find (...) in scope"
Playgrounds and an actual project are different in syntax. Specifically when you're going to a view controller which you are if you're working in contentView. A view uses SwiftUI which is what you see and interact with (an interface) and classes use Swift. The code for these two are not interchangeable which is why you're getting this error. If you have any questions or specific examples of your code that's getting an error just reply to this response.
Jun ’22
Reply to How to auto adjust the height of list row in edit mode?
Replace your ListEditTest file with this code or just add the .frame() part. I've changed everything to work in your file just replace the comment with an INT. import SwiftUI struct ListEditTest: View {     @State private var selects: Set<Int> = []         var body: some View {             VStack{                 EditButton()                 List(selection: $selects){                     ForEach(1..<5){                         ItemInList(num: $0)                     }                     .frame(height: /*Preferred height of each item as an INT*/)                 }                 .listStyle(PlainListStyle())             }         } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’22
Reply to Searching with @FetchRequest
I’m getting some errors from: func searchResults(searchingFor: String) -> [Recipe]{         var searchRecipes=recipe.filter({$0.title.contains(searchingFor)})         return searchRecipes     } Value of optional type 'String?' must be unwrapped to refer to member 'contains' of wrapped base type 'String' Chain the optional using '?' to access member 'contains' only for non-'nil' base values Force-unwrap using '!' to abort execution if the optional value contains 'nil'
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’22
Reply to Where do I start?
CodeWithChris is a good place to start. He makes videos teaching the basics to swift and SwiftUI. Also YouTube is a good way to learn stuff. If you have previous coding experience start with a small project and look up solutions or post on here when you run into a roadblock. If you have no previous coding experience follow CodingWithChris’s tutorial and then make a small project.
Jun ’22
Reply to Testing CloudKit Apps using the simulator
So I just ran an app that has CloudKit on my iPhone and iPad to text if what I heard, which was that you needed to be part of the Apple developer program to use CloudKit, was true. And the data that I inputted on my phone was not going to my iPad. So if you pay $100 annually, which isn’t a bad investment if you plan on doing this for a while and getting in bested, for the Apple development program.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’22
Reply to FetchedResults to Array (Error)
Okay so I’ve finally found somewhere else that said you can’t use a fetch request outside of a view. But if I pass in the fetch request made in the view as a parameter I wouldn’t be able to use the dynamic string searchingFor in the declaration of my FetchRequest. Any ideas?
Topic: Programming Languages SubTopic: Swift Tags:
Jun ’22
Reply to Reversing string with ignoring characters
Have you considered removing the spaces, saving the location of the spaces relative to the beginning, executing the reverse part, then replacing the spaces with the same location but from the end instead of the beginning? I’m not sure how you want your spacing to work with some letters moving and some letters not moving because a letter stating in place may increase the length of the word which would screw everything up. Try that and let me know what tweaks need to be made and maybe we can brainstorm.
Topic: Programming Languages SubTopic: Swift Tags:
Jun ’22