Post not yet marked as solved
@franc
could you send me a screenshot of what it look like for DisclosureGroup , to see if it could help me
then I could buy it. my goal is to learn to read API documentation, so I could follow as everything evolve.
thank you
Post not yet marked as solved
@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.
wow, I look really bad now :-)
but it worked , both method.
I will get more sleep now
Post not yet marked as solved
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
Post not yet marked as solved
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
Post not yet marked as solved
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
Post not yet marked as solved
I have tried it directly on the simulator, and it look good, it is on the device (on ios 13), that I have the problemwith auto-layout.
Post not yet marked as solved
Ok thank you.I will wait before doing that.The computer I have on Catalina is not the one i use to code but jsut to test... but i guess, i will have to redo those constraints .Oh i will try to do it on a copy and try to see what changed.
Post not yet marked as solved
Thank you, i was scare for a moment.
Thank you ! learn a lot reading those link. Can i use those Profiles https://developer.apple.com/bug-reporting/profiles-and-logs/?platform=iosto get information without sending it to Apple ?The App is not on the store and for now, the App is just for me, but i might make it open source if it gets better.it is a lot of work to rewrite all my print to follow the format needed to log. :-)
Post not yet marked as solved
I prefer to use Alt-Drag to make a copy of an item.there are many modifier that you can apply while draging an item. for example:CMD-Drag an item to another drive, will make a copy of the folder and remove it from the first drive ALT-CMD-Drag will just make an alias etci use the copy and paste of folder/item when i work on windows.
Thank you. I will offer the user to average data , for example, every 5 seconds or something like datai wish i could create entity without puting it into the context, to keep it around until i ahve the number i need to average and then discard it wihtout having to remove them from coredata, I might use other var to do that for now.i also created an option to erese all data in coredata and i show filesize to help the user decideone day I hope to offer Export to file before erasingI dont like to use opensource package but I might do it to graph the data because I dont have much time for this app.
OOHHHHI selected 3 files with one of them was my entity class file RideData and choose New group with selectionthe folder was create with the 3 filesbut then Magically, another RideData Appear outside of this folder but in read I deleted the file, built and error was gone !!!