Post

Replies

Boosts

Views

Activity

Reply to Help with documentation : example: DisclosureGroup
Thank you for your help. you are right about Identifier, I should use an uppercase L when I write an identifier like Label. I have used generic in the past, but I will go back to try read that part in Apple "the Swift programming language, version 5.3 " I am currently doing the CP193P from Stanford with Paul Hegarty based on the first SwiftUI I do his class in part almost every year, this has to do with my new brain condition. but in parallel I listen to 2020 wwdc video I wrote a long text with all code I tried and the result I got, but while writing this I think I have understand something. I will do some test, reading and come back with probably a better question. Thank you again
Jan ’21
Reply to Help with documentation : example: DisclosureGroup
hello OOPer here is what I tried so far to try to understand how it work _______________________________________________________ Documentation init<S>(S, content: () -> Content) Creates a disclosure group, using a provided string to create a text view for the label. Available when Label is Text and Content conforms to View. _______________________________________________________ and in the Definition : public struct DisclosureGroup<Label, Content> : View where Label : View, Content : View {     /// Creates a disclosure group with the given label and content views.     /// - Parameters:     ///   - content: The content shown when the disclosure group expands.     ///   - label: A view that describes the content of the disclosure group.     public init(@ViewBuilder content: @escaping () -> Content, @ViewBuilder label: () -> Label)     /// Creates a disclosure group with the given label and content views, and     /// a binding to the expansion state (expanded or collapsed).     /// - Parameters:     ///   - isExpanded: A binding to a Boolean value that determines the group's     ///    expansion state (expanded or collapsed).     ///   - content: The content shown when the disclosure group expands.     ///   - label: A view that describes the content of the disclosure group.     public init(isExpanded: Binding<Bool>, @ViewBuilder content: @escaping () -> Content, @ViewBuilder label: () -> Label)     /// The content and behavior of the view.     public var body: some View { get }     /// The type of view representing the body of this view.     /// When you create a custom view, Swift infers this type from your     /// implementation of the required body property.     public typealias Body = some View } _______________________________________________________ from this struct DisclosureGroup<Label, Content> : View where Label : View, Content : View I expect to call disclosure with 2 view. but it does not seems to work. I decide to do some test with the first parameter as a string, because I knew it work and try to give the content for the 2 parameter Test 2 - I tried this and it work struct ContentView2: View {     var body: some View {         DisclosureGroup("Lightning") {             Text("Fast")         }     } } Test 3: I tried to enter the Text view into the disclosure calling , did not work but the content should be () -> Content and Text is taking an argument ... struct ContentView3: View {     var body: some View {         DisclosureGroup("Lightning", content: Text("Fast") )     } } Test 4 with the last argument inside - calling a var of type some View - did not work struct ContentView4: View {     var body: some View {         DisclosureGroup ("Lightning", content: ContentViewSmall1)     } } struct ContentViewSmall1: View {     var body: some View {         Text("ContentViewSmall 1")     } } Test 5 with the last argument inside - calling a func that return some View - Worked struct ContentView5: View {     var body: some View {         DisclosureGroup ("Lightning", content: ContentViewSmall2)     } } func ContentViewSmall2() -> some View {     return Text("ContentViewSmall 2 ") } I know I am doing something wrong, and mostly I have an error in my thinking. if you can help me, it would be great , thank you
Jan ’21
Reply to Help with documentation : example: DisclosureGroup
Thank you for taking the time to help me. I know I am slow to learn since my brain problem. I dont get an alert when there is a new post. we use to have a button for that. Test 3: I tried to enter the Text view into the disclosure calling , did not work  but the content should be () -> Content and Text is taking an argument ... As the error message is clearly stating, content needs to be a closure. struct ContentView3: View { var body: some View { DisclosureGroup("Lightning", content: {Text("Fast")} ) } ok, I see it now. What I meant by Enter the Text View, it is because I thought that it was a case where the last argument is a closure and it can be taking out , so I was trying to put it back in call disclosure does not make sense. not sure how to name it, it is a struct of type View that need parameter when I created it, and I guess I call the init when I create it ? Have you really read the Swift book?  I was up to generic, before posting I am going slowly I did learn generic in school in a C sharp class but I was 54 returning to school, and my brain was already damaged. I am old :-) I started way back on paper terminal and then on punch card :-) I did 100 days of swiftui of Paul Hudson at HackingWithSwift. and every year (when available) I follow the CS193P of Paul Hegarty of Stanford. I have an app that I use for myself, that get data via bluetooth from my solar eBike, do some calculation ,display all the results and save it to core data . I want to convert it to swiftui but I see that I need a lot more preparation. reading is very difficult for me now , strangely a lot more than writing. Discussion is easier. but I dont want to impose. I will look into finding a mentor on the web. thank you
Jan ’21
Reply to Help with documentation : example: DisclosureGroup
@OOPer thank you old is not the problem :-) learning a language was kind of easy because I have learn so many variant of basically the same thing :-) and even with a good brain, I think. my problem is with api documentation like we discuss earlier going from oop to declarative, is also a bit difficult. I managed to create an infinite loop when SwiftUI was announce :-) I remember fortran on Punch card where we had to put a certain character in column 6 or 7 (6 it seems after a web search) now in SwiftUI there are some times where I feel the same ways, I am not sure where to put stuff in Body. but I loved it so I will get it... one day.
Jan ’21
Reply to Open source and AppleID
I am just worry about people downloading the project to find my name in the file. After reading your post, I did some test. I saw my name in the file project.pbxproj but I now realize that my bundle identifier is base on my website which contains my name. :-) I will change that, For the AppleID, I try to open the zip file downloaded from Github in another account on my Mac, and in the same file the Team now show unknown name with a number . So the AppleID is kind of hidden. I guess that would be impossible to find my appleId based on that number. I should be ok. What do you think ? Thank you
4w
Reply to Open source and AppleID
this is what I can see opening the downloaded GitHub project on a computer that does not have my apple account . the green are where the bundle identifier has my name in it, I will correct that. The and red is where my name use to be , but now show only a number which I am ok with. :-)
4w
Reply to Open source and AppleID
Thanks you. I did not knew that, I checked and I did found another instance of my unique identifier, which will be gone in the new app. No problem there. I did found a reference to a file, with a path that does not exist anymore I dont know why it is still there but it will also be removed because I will do a complete rewrite anyway. I think my problem is resolve. Time for a new one :-)
3w