Post

Replies

Boosts

Views

Activity

Reply to Swift program
Write a Swift program to test whether a value presents sequentially three times in an array of integers or not Without using in-built function. Is this a homework for you? You would get better responses sooner if you could show what you had done till now.
Topic: Programming Languages SubTopic: Swift Tags:
May ’21
Reply to GeometryReader's size is 0 when enclosed inside NavigationView
So is there any elegant way to find out if it's being evaluated the second time?  Always be ready for being evaluated multiple times. It crashes the view because of those 0s. You may need to make your method 0-size-tolerant. (Your code looks like an old C-code and very hard to read. I strongly recommend you to follow the modern coding rules. You are writing code in Swift, not C.) var body: some View { NavigationView { GeometryReader { geometryProxy in VStack { ZStack { if geometryProxy.size != .zero { draw_lines_of_quadrant(screen_width: geometryProxy.size.width, screen_height: geometryProxy.size.height) } } } } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’21
Reply to GeometryReader's size is 0 when enclosed inside NavigationView
As far as I tried, GeometryReader gives size 0 at the first time when body is evaluated, but gives the right screen size at the second time. All such things may depend on the inner views. Can you show the definition of draw_lines_of_quadrant(screen_width:screen_height:)? By the way, snake_case_identifiers are not popular in Swift apps. You should better follow the standard coding styles of Swift.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’21
Reply to How can I pass a UILabel as a URL in Swift?
when I click the button nothing happens,  Then your storyboard is broken, and the action of the button is not connected to the IBAction method. Have you connected the action properly on the storyboard? No edit has made after you connected? Are you sure you are instantiating the view controller through the storyboard?
Topic: UI Frameworks SubTopic: UIKit Tags:
May ’21
Reply to Swift functions
10 and x Int and String (or String and String)? You once said: i want to make a function with array  Please clarify: All the parameters, with the types of them and how they affect the result Result type, Array of String? Or Array of Array of String (often used as a 2-D array)? Or something else?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Apr ’21
Reply to Swift functions
i want to make a function with array  So, you want to define a function taking Array and Int. OK? And you have not answered to my other questions. Do you just want to write? No need to create an Array? What will be the values of the Array and Int for the example output: Please clarify all the things needed to write a function.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Apr ’21