kai inui

Android, iOS, Go, Java Developer
UI / Interaction Designer

Read this first

Adopt Protocol Buffers instead of JSON

Protocol Buffers are a data interchange format used in Google. (also developed by Google)

It looks like as follows.

package main;

message Book {
    required string title = 1;
    required int32 page_number = 2;
    required string author_name = 3;
}

Protocol buffers encoded data are binary. They are encoded really efficiently.

You can compare them with JSON. Protocol buffers encoded messages using .proto above can be represented in JSON as follows.

{
  "title": "SomeTitle",
  "page_count": 12,
  "author_name": "SomeAuthor"
}

What is different between Protocol Buffers and JSON is serializing and deserializing. Because protocol buffers specifies its structure in .proto (You saw above), Protocol Buffers serialized data can be deserialized easily as follows. (Assume that bookData is protobuf serialized data.)

Book *book = [Book parseFromData:bookData]

The structure is described

Continue reading →


UI Testing with KIF

With KIF, you can easily perform UI tests.

platform "SomeProjTests", :exclusive => true do
  pod "KIF"
end

And in SomeProjTests.m,

#import <KIF.h>

[tester longPressViewWithAccessibilityLabel:@"Label" value:nil duration:0.5f];
[tester tapViewWithAccessibilityLabel:@"Edit"]; // `UIMenu` Edit
[tester enterTextIntoCurrentFirstResponder:@"Hi! Test!"];
[tester tapViewWithAccessibilityLabel:@"return"]; // Keyboard return

Note that Accessibility Label is a text you can see (literally) in every UI elements. (e.g. For label which have text “Label”, its accessibility label is “Label”. For button “Edit”, its accessibility label is “Edit”.)

Using accessibility labels, you can perform UI tests as above.

You can see the result in following Vine.

 FAQ

 Is it difficult?

Definitely No. You just need to write one pod in Podfile while appium requires some setups. There are no prerequisites.

Continue reading →