Custom set in swift
Added comments for the generate method