Updated Swift sample code