当前位置:网站首页>swift获取url参数

swift获取url参数

2022-07-07 23:15:00 清醒思考

swift获取url参数

public extension URL {
    
    var urlParameters: [String: String]? {
    
        guard let components = URLComponents(url: self, resolvingAgainstBaseURL: true),
        let queryItems = components.queryItems else {
     return nil }
        return queryItems.reduce(into: [String: String]()) {
     (result, item) in
            result[item.name] = item.value
        }
    }
}
原网站

版权声明
本文为[清醒思考]所创,转载请带上原文链接,感谢
https://blog.csdn.net/pureszgd/article/details/125668037