Pastey's Blog

Pavlo Shkrabliuk, Software Developer


Project maintained by pastey Hosted on GitHub Pages — RSS — Theme by mattgraham

Remove a Git tag. Mission impossible

Sure, you can do git tag -d <tagname> and then git push --delete origin <tagname>. But chances are high that the tag will resurrect soon. Keep reading if you want to know more.

Read More


An unexpected human-machine interaction peculiarity in an iOS app

We’ve got a bug. The pen tool didn’t work on M2 iPad with the Wrist Protection setting enabled.

Our Wrist Protection was added long ago when we were making Remarks – the note-taking app based on our PDF library. Pen was the main tool in that app. In our testing, we found that quite often the palm laying on the iPad screen would produce some touches. Our code didn’t know if a finger or a wrist had produced the UITouch, so those accidental touches made pen marks on the page bottom. Wrist Protection filters our touches with majorRadius larger than a threshold that we heuristically found out.

So, back to the nowadays bug. Please take a look at the video demonstrating it.

Read More

UIBandSelectionInteraction vs. UICollectionViewCell background color

One of my colleagues (kudos, Nik) added the proper support of the pointer at iPad OS during our Ship It days (approximately once a month we can do any feature/improvement we want). After some time the team jumped in and we all were preparing it for release.

When it came to QA, we’ve got a strange ticket: file list view in Select mode would sometimes deselect all previously selected items. I drew the stick for this ticket and dived into it. The reason for the bug was obvious at first glance – band selection (UIBandSelectionInteraction) triggered 1x1 selection at the tapped cell, which did what it had to do – cleared the previous selection and selected the cells (that single one) that were intersected by the selectionRect.

Read More

A sad story about Swift Equatable

This is the story about the cunning Equatable in Swift.

Let’s start as advertised. Everything’s cool, everything works:

class Person: Equatable {
    let name: String

    init(name: String) {
        self.name = name
    }

    static func == (lhs: Person, rhs: Person) -> Bool {
        Swift.print(">> Person operator == called")
        return lhs.name == rhs.name
    }

    static func != (lhs: Person, rhs: Person) -> Bool {
        // Ususally I won't implement this operator – compiler will generate one.
        // I just want to add some logs
        // Even if I had to implement !=, I would impelement it via ==.
        // For the sake of logging, let it be really dumb
        //
        Swift.print(">> Person operator != called")
        return lhs.name != rhs.name
    }
}

let john = Person(name: "John")
let jack = Person(name: "Jack")

Check. All correct. Let’s dive into the real life.

Read More