Add branching to swift