Ported category to Swift extension