This is complex, why don't you simply say isHeaderViewActive = !isHeaderViewActive