1

Hacktoberfest - Working with Swift

 2 years ago
source link: https://dev.to/kiennguyenchi/hacktoberfest-working-with-swift-7m
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

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 modeExit 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 modeExit 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 modeExit fullscreen mode

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

self.saveLink()
self.tableView.reloadData()
Enter fullscreen modeExit 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.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK