UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

I need your help ,thanks with my heart.

Forums > 100 Days of SwiftUI

Description: When I conclude project 9 days three I found some problems.

 We create a checkerBoard with four rows and four columns,then if the sum of the row number and column number can be perfectly divided by 2,we draw a rectangle.

              let startX=columnsize*CGFloat(column)
              let startY=rowsize*CGFloat(row)

              let rect=CGRect(x: startX, y: startY, width: columnsize, height: rowsize)

             mypath.addRect(rect)

But I have a new ideal,what should I do if I want draw a circle? So,I try to do that by myself,and the following code is what I did,unfortunately,it doesn't work well:

                let startX=columnsize*CGFloat(column)
                let startY=rowsize*CGFloat(row)

                //let rect=CGRect(x: startX, y: startY, width: columnsize, height: rowsize)

               // mypath.addRect(rect)

                mypath.addArc(center: CGPoint(x:startX+columnsize/2, y: startY+rowsize/2), radius: rowsize/4, startAngle: .degrees(0), endAngle: .degrees(360), clockwise: true)

The problem is that I just see only one circle on my screen,but it should be more actually.I guess the key is "mypath.addArc"just performs once,I think about it a lot and can't find a solution to solve it.

I am so sorry for taking your time to turn to you,but I do have no idea about it,so ,thanks again,sincerely.

2      

Hacking with Swift is sponsored by Essential Developer

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.