Hacktoberfest - Working with Swift

kiennguyenchi

Kien Nguyen Chi

Posted on October 28, 2021

Hacktoberfest - Working with Swift

Project Introduction

👉 Since starting of this semester, I took an IOS app development class. I was impressed by how XCode is convenient for the user to build the app interface, it is like dragging and dropping things in Adobe Photoshop.

👉During the Hacktoberfest month, I wanted to work on an open source app in Swift language to explore how the IOS app truly works in the real world.

👉The project is about Bookmark containing saved important links with categories for user to read them later. You can take a look at its GitHub Repo or my Folked Repo.

Project Issue

âť“I took an issue to add favorite feature to the app. With the following links display, whenever an user clicks on the bookmark button besides it. It would pin to the top of the list

👉I spent hours to read through the project for to find where to put my code in, run the Simulator to see how the app works.

👉I took me a lot of time to complete this project since I don't have a Mac yet, it is inconvenient to work with IOS app because XCode serves Mac user only. I had to borrow a Mac from my friend, installed the Xcode 12GB with my slow Internet connection, wrote the code, ran it, returned to her and borrowed back one day.

đź”—This is my filing Issue on GitHub.

Project Process

I knew that what I have exactly to do. First step, I needed to get the data from the view, the table cell data and its index.

var linkView = sender.superview
while let view = linkView, !(view is UITableViewCell) {
     linkView = view.superview
}
guard let tableCell = linkView as? UITableViewCell else {return}
guard let indexPath = tableView.indexPath(for: tableCell) else {return}
Enter fullscreen mode Exit fullscreen mode

Next, I needed to remove the link from the current index, which was currently showing on the screen.

let link = self.links[indexPath.row]
self.links.remove(at: indexPath.row)
Enter fullscreen mode Exit fullscreen mode

Next, I needed to insert it at index 0, because after I added it to the bookmark, it would stay on top of the list.

self.links.insert(link, at: 0)
Enter fullscreen mode Exit fullscreen mode

In final step, I needed to save my modification and reloaded the interface.

self.saveLink()
self.tableView.reloadData()
Enter fullscreen mode Exit fullscreen mode

đź”—This is my Pull Request on GitHub.

Conclusion

👉The owner of this repo is so slow in replying, which sometimes inconvenient to me to interact. It may take up to a week for a reply.

👉Overall, it is fantastic to work on an actual open source IOS app in the real world. I can see some very similar code structures and designing tools that I learnt in class. Wanna keep falling in love with Swift and Xcode, I really need to save money to get a Mac.

✔️During the Hacktoberfest, I worked with total 4 different programming languages/framework, which would make me so excited about open source programming. I had try Rust, Vue, React and Swift, very unfamiliar to me a month ago, but familiar now.

đź’– đź’Ş đź™… đźš©
kiennguyenchi
Kien Nguyen Chi

Posted on October 28, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Refactoring the SSG Convertor
opensource Refactoring the SSG Convertor

October 15, 2021

Hacktoberfest - Working with Swift
opensource Hacktoberfest - Working with Swift

October 28, 2021

PagerTabStripView - open source
opensource PagerTabStripView - open source

October 14, 2021

Lab 01 - Static Site Generator Collaborations
opensource Lab 01 - Static Site Generator Collaborations

September 17, 2021