WWDC22 SALE: Save 50% on all my Swift books and bundles! >>

SOLVED: Project 2 - BorderWidth creates a padding between image and borderlayer

Forums > 100 Days of Swift

Hi there!

I've recently started to follow the 100 days with Swift and I am currently working on the 2nd project ( The flag game ). I have one small issue though, which I am not sure how to resolve.

When adding a layer of borderWidth = 1 to the button and eventually assigning it a lightgrey color. There is this weird gap/padding between the button's image and the border.

(See the picture) https://imgur.com/a/AjSaUCj

What is the way to resolve this problem and have the border going around the button like in the video fo this lecture? Cheers, Peter


Hi Peter! It's been answered here


Hacking with Swift is sponsored by Emerge

SPONSORED Optimize your app’s startup time, binary size, and overall performance using Emerge’s advanced app optimization and monitoring tools. Reliably measure app size, speed up your app's startup time with Emerge's Launch Booster, and much more. Emerge is actively used by many of the top mobile development teams in the world.

Find out more

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

Reply to this topic…

You need to create an account or log in to reply.

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.