如何使用簡易工廠模式
// FlickrAPI.swift
import Foundation
class FlickrAPI{
static func flickrAPIUrl() ->String{
return "https://api.flickr.com/services/rest/"
}
static func flickrInterestingness(aPageIndex:UInt = 1,aPerPage:UInt = 99) -> Dictionary<String,String> {
let _paramters:Dictionary<String,String> = [
"method" : "flickr.interestingness.getList",
"api_key" : "your_flickr_api_key",
"per_page" : "\(aPerPage)",
"format" : "json",
"nojsoncallback" : "1",
"extras" : "url_q,url_z",
"page" : "\(aPageIndex)"
]
return _paramters
}
}
Last updated