📜 ⬆️ ⬇️

HabraReader - easy to read Habrahabr on iOS devices

Some time ago I decided to start developing programs for iOS. I wanted to write something for the soul and as the first project I chose the application for my favorite site habrahabr.ru, because at that time there was no convenient program for reading the site posts that satisfy my requirements. I imagined what properties an application should have that I would use daily, and I got the following list:



Actually, it will be about how I solved the tasks and what happened in the end.

')

Training



First of all, I decided to prepare theoretically: I looked at the Stanford courses , read the book “Programming for the iPhone and iPad” Paylon, studied the iOS development books on the App Store. Just want to say that I did everything not quite right, or even completely wrong. We liked the courses very much: the speaker has a sense of humor, clearly knows and loves what he is talking about. However, it would be better to listen to these courses and at the same time to apply in parallel what they are talking about. In my case, much of what was said was “weathered” by the time when it came to the practical use of the knowledge gained. I bought the book under the impression of a good edition of design patterns from the same series, but it absolutely disappointed me - too much water and banality. The development books for iOS downloaded in the App Store I clearly read in the wrong order. Somewhat later, Apple released a great introduction to the development , which I advise all novice iOS programmers.

As a result, much more time was spent on the preparatory part than was required.

Development



One of the most important and successful decisions made at the beginning of development was the use of cocoapods for dependency management. Using cocoapods, connecting a new library takes quite a bit of time. Due to 15 years of experience in developing commercial C ++ programs, I was very tempted to write the entire model in my native language, but I kept myself, deciding that if you really learn a new platform, then do it to the end. As a result, marveling at the “clumsiness” of local containers, I drank the cup to the bottom, writing absolutely everything in Objective C. Perhaps in the following projects I’ll still try to use the boost model (the library is in cocoapods) - I suspect the process will go much faster .

One of the main requirements in the development was the support of habracut and the ability to read the beginning of the article, see pictures and videos in the list of posts. I solved this problem using the standard UITableViewCell class with a variable height. Each cell is displayed using Core Text, that is, in this place I completely abandoned the built-in browser UIWebView. This is the result for iPad in horizontal orientation:


in vertical orientation:


Horizontal orientation for iPhone:


It can be seen that the TabBar for horizontal orientation is moved to the left, which has saved valuable valuable space vertically, and it is more convenient to switch tabs with the fingers of your left hand.

For the iPad, it was necessary to solve the problem of displaying the list of hubs separately. I had to abandon the standard UISplitViewController - I could not find a simple solution to show / hide the master view (list of hubs) using animation and used one of the numerous libraries with support for sliding views. The result was something like this:


I wanted to leave the screen for reading the article as free as possible. Initially, only the ToolBar is shown, but you can switch to full screen mode (the ToolBar and StatusBar will be hidden). Only the most necessary remains in the list of controls:

Here’s how it looks for the iPhone:


iPad version:


Fullscreen option:


For convenience, various gestures have been added:



For synchronization between devices, iCloud is naturally used. Due to the fact that for the reading list only the numbers of posts are transmitted, and for the favorites list only the beginning of each post (without pictures), it was possible to achieve minimal traffic usage. The application itself is free, but in the list of posts there is a screwed advertisement that can be turned off via in-app purchase. There are no functional limitations for the free version.

Plans


Depending on how interesting everyone is, I plan to write more about the technical aspects of development. There are also big plans to improve the application:


A huge request to write about your wishes, comments, leave feedback and good ratings, what would be the motivation to improve the application further.

The application itself can be found at this address.

Source: https://habr.com/ru/post/169563/


All Articles