Updated for latest Swift.