Update magic.swift

Make more functional like