swift api usage examples