What I Worked On
This time around I decided to try out another open source Swift project. After some digging around Github, I found the repository for the Brave iOS browser. This felt like the perfect second project to work on since my first two contributions for Hacktoberfest were for the focus iOS browser. This would allow me to transfer my knowledge between the two iOS browser projects.After looking through some of the posted issues I ended up finding one that I wanted to work on. It was a layout issue where a popup would clip off the phone's screen if it was in landscape mode. Instead of rushing into the problem, I decided to take my time and read through the relevant codebase - as I learned to do after my first Hacktoberfest contribution - to figure out an approach on how to tackle this problem.
The Fix
I had to work out a simple algorithm to layout the subviews to change their sizes proportionally to shrink the container to fit in the bounds of the screen. Initially, the code would set the heights of the views based on the available width and font size.To fix the issue, I had to figure out the amount that every element had to be resized by to allow for the entire popup to fit on a compact screen. To do this, I had to take the external heights of the popup into consideration, including the buttons and the padding between the views. The following is the formula used to determine the resize percentage to fit:
The code was then changed to take the resize percentage into consideration.
No comments:
Post a Comment