Swift way to explore patterns