{"id":1654,"url":"https://github.com/isamankumara/skywite","last_synced_at":"2025-08-02T04:32:10.001Z","repository":{"id":62455567,"uuid":"82280580","full_name":"isamankumara/skywite","owner":"isamankumara","description":"This is swift version for swnetworking","archived":false,"fork":false,"pushed_at":"2017-02-21T09:15:14.000Z","size":68,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-25T03:40:00.690Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/isamankumara.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-17T09:30:29.000Z","updated_at":"2021-03-27T11:45:39.000Z","dependencies_parsed_at":"2022-11-02T00:16:45.017Z","dependency_job_id":null,"html_url":"https://github.com/isamankumara/skywite","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/isamankumara/skywite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isamankumara%2Fskywite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isamankumara%2Fskywite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isamankumara%2Fskywite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isamankumara%2Fskywite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/isamankumara","download_url":"https://codeload.github.com/isamankumara/skywite/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isamankumara%2Fskywite/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268334615,"owners_count":24233793,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-01-05T20:15:52.411Z","updated_at":"2025-08-02T04:32:09.673Z","avatar_url":"https://github.com/isamankumara.png","language":"Swift","funding_links":[],"categories":["Networking"],"sub_categories":["Video","Other free courses"],"readme":"# \u003cp align=\"center\" style='color:#30a1f3' \u003eSkyWite\u003c/p\u003e\n\n\u003cp align=\"center\" \u003e\n\u003cimg src=\"http://skywite.com/wp-content/uploads/2015/05/skywite.png\" alt=\"Skywite\" title=“SkyWite”\u003e\n\u003c/p\u003e\n\n\n[![Version](https://img.shields.io/cocoapods/v/SkyWite.svg?style=flat)](http://cocoapods.org/pods/SkyWite)\n[![License](https://img.shields.io/cocoapods/l/SkyWite.svg?style=flat)](http://cocoapods.org/pods/SkyWite)\n[![Platform](https://img.shields.io/cocoapods/p/SkyWite.svg?style=flat)](http://cocoapods.org/pods/SkyWite)\n[![Twitter](https://img.shields.io/badge/twitter-@SWframeworks-blue.svg?style=flat)](http://twitter.com/SWframeworks)\n\n\n\nSkyWite is an open-source and highly versatile multi-purpose frameworks. Clean code and sleek features make SkyWite an ideal choice. Powerful high-level networking abstractions built into Cocoa. It has a modular architecture with well-designed, feature-rich APIs that are a joy to use.\n\nAchieve your deadlines by using SkyWite. You will save Hundred hours. \n\nStart development using Skywite. Definitely you will be happy....! yeah..\n\nSkyWite being developed in clean code and its sleek features make it the “Dream Framework” for any iOS / Macos developer. Its modular architecture and feature-rich APIs makes it very simple for development. SkyWite’s powerful networking abstraction is built using Cocoa, which makes it easily available for everyone,\n\nIts core being developed on Objective C,  makes it compatible on the following platforms :\n-        iOS,\n-        Mac OS X,\n-        TV OS and\n\nThe next question that would pop for any developer is, why build a framework as such when there a many similar ones available. The answer was quite straight forward. 9 out of 10 frameworks out there in the market have the following features:\n\n1. Support all request methods\n2. Offline request support\n3. HTTP request operation manager\n4. Cocoa Pod Support\n5. SWIFT Compatible\n6. Supports Apple UI Kit.\n7. Background request support\n8. Session manager\n9. Reachability manager\n10. Secured \n11. Free support offered around the framework\n12. The framework will be continuously updated with the new OS drops\n13. Community around the framework to support bug fixes\n14. Code amendment flexibility\n16. 99% Guaranteed on crash management for the framework\n17. Block support\n18. MIT License\n\nAbove features are not only available on the other frameworks in the market, but is also available on SkyWite, but here is what makes SkyWite special:\n\n19. Offline sync support\n20. The frameworks adds in a loading indicator when a request is sent, allows for addition of custom indicators as well\n21. A sing line of code to initiate a request, which will approximately save 20 lines of code\n22. Block with background request\n23. Tag a request (set int value to identify requests)\n24. Set priority for offline requests.\n25. All the request/response body will generated automatically which would save the developer approximately 50-70 lines of coding\n\n\nAs same as the swnetworking framework we released earlier, this framework also doesn't have any issue. If you find any, I'll fix them as soon as possible. Now we don't need a team as there is no such issues to fix.\n\n\n# Requirements\n\nYou need to add \"SystemConfiguration\" framework into your project before implement this.\n\n\n#How to apply to Xcode project\n\n### Downloading Source Code\n- [Download Skywite](https://github.com/isamankumara/skywite/archive/master.zip) from gitHub\n- Add required frameworks\n\n### Using CocoaPods\n\nSkyWite is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod \"SkyWite\"\n```\n\nIf you are new to CocoaPods, please go to [Wiki](https://guides.cocoapods.org/using/getting-started.html) page.\n\n\n### Communication\n\n- If you **need any help**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/skywite). (Tag 'skywite') or you can send a mail with details ( we will provide fast feedback )\n- If you'd like to **ask a general question**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/skywite).\n- If you **found a bug**, _and can provide steps to reliably reproduce it_, open an issue or you can contribute.\n- If you **have a feature request**, send a request mail we will add as soon as possible.\n- If you **want to contribute**, submit a pull request.\n\n#Architecture\n\n\n* `SWRequest`\n    - `SWRequest`\n    - `SWGet`\n    - `SWPost`\n    - `SWMultiPart`\n    - `SWPut`\n    - `SWPatch`\n    - `SWDelete`\n    - `SWHead`\n    - `SWOfflineRequestManger`\n* `ResponseType`\n    - `SWResponseDataType`\n    - `SWResponseJSONDataType`\n    - `SWResponseXMLDataType`\n    - `SWResponseStringDataType`\n    - `SWResponseUIImageType`\n    - `SWRequestDataType`\n    - `SWRequestFormData`\n    - `SWRequestMultiFormData`\n    - `SWRequestJSONData`\n* `Reachability`\n    - `SWReachability`\n* `File`\n    - `SWMedia`\n* `UIKit+SkyWite`\n    - `UIImageViewExtension`\n    - `UIProgressViewExtension`\n\n# How to Use\n\n## Use HTTP Request will be `NSURLSession`\nALL Requests will be NSURLSession. Session will add in to `NSOperationQueue` . Request creation , response serialization, network reachability handing and offline request as well.\n\n### `GET` Request\n```swift\nlet s  = SWGet()\ns.startDataTask(url: \"\", params:nil, success: { (task, object) in\n}) { (task, error) in\n    print(\"error\", error)\n}\n```\nIf you want send parameters you have two options\n\n```swift\nlet s  = SWGet()\ns.startDataTask(url: \"\", params:\"name=this is name\u0026address=your address\", success: { (task, object) in\n}) { (task, error) in\n    print(\"error\", error)\n}\n```\nIf you want to encdoe parameters and values you need to pass `Dictionary` object with keys/values.\n\n```swift\nlet s  = SWGet()\ns.startDataTask(url: \"\", params:\"name=this is name\u0026address=your address\", success: { (task, object) in\n}) { (task, error) in\n    print(\"error\", error)\n}\n```\n\nWe are recommend to use second option because if you have `\u0026` sign with parameter or value it will break sending values.\n\n###  `GET` with Response type \nAvailable as response types\n`SWResponseJSONDataType`, `SWResponseJSONDataType`, `SWResponseXMLDataType`,` SWResponseStringDataType`,`SWResponseUIImageType`  \nYou need set `responseDataType`.\n\n```swift\n// this response will be JSON\nlet s  = SWGet()\ns.responseDataType = SWResponseStringDataType()\ns.startDataTask(url: \"\", params:nil, success: { (task, object) in\nprint(\"item\", object)\n}) { (task, error) in\n    print(\"error\", error)\n}\n```\n### `GET` with loading indicator\nIf you set your parent view to method, loading indicator will be displayed. \n```swift\nlet s  = SWGet()\ns.responseDataType = SWResponseDataType()\ns.startDataTask(url: \"\", params:nil, parentView: self.view , success: { (task, object) in\n    print(\"item\", object)\n}) { (task, error) in\n    print(\"error\", error)\n}\n```\n\nIf you want custom loading view you need to add new `nib` file to your project and name it as 'sw_loadingView'. It will be displayed on the screen.\n### Cache Response\nIf you want to access cached data on the response. You need to use relevant method that include cache block\n```swift\nlet s  = SWGet()\ns.responseDataType = SWResponseStringDataType()\ns.startDataTask(url: \"\", params: nil, parentView: self.view, cache: { (response, object) in\n    print(\"chache\", object)\n}, success: { (task, object) in\n    print(\"success\", object)\n}) { (task, error) in\n    print(\"success\", error)\n}\n```\n### `POST` request (simple)\nCache, Loading view available for the on the relevant method. Please check available methods\n```swift\nlet s = SWPost()\ns.responseDataType = SWResponseStringDataType()\ns.startDataTask(url: \"\", params:[\"name\":\"this is name\", \"address\": \"your address\"] as AnyObject  , success: { (task, object) in\n    print(\"item\", object)\n}) { (task, error) in\n    print(\"error\", error)\n}\n\nlet s2 = SWPost()\ns2.responseDataType = SWResponseStringDataType()\ns2.startDataTask(url: \"\", params:\"saman=test\" as AnyObject  , success: { (task, object) in\n    print(\"item\", object)\n}) { (task, error) in\n    print(\"error\", error)\n}\n```\n\n### `POST` multipart request\nIt is really easy.\n```swift\nlet s = SWPost()\n\nlet image = NSImage(named: \"skywite\")\nlet imgData = pngRepresentationOfImage(image: image!)\n\nlet media1 = SWMedia(fileName: \"imagefile.png\", key: \"image\", data: imgData)\nlet media2 = SWMedia(fileName: \"imagefile.jpg\", key: \"image2\", mineType:\"image/jpeg\", data: imgData)\n\ns.responseDataType = SWResponseStringDataType()\ns.startUploadTask(url: \"\", files:[media1, media2] , params: [\"name\":\"this is name\", \"address\": \"your address\"] as AnyObject, success: { (task, object) in\n\n}) { (task, error) in\n\n}\n\n//create with custom mine type one\n\nlet media2 = SWMedia(fileName: \"imagefile.jpg\", key: \"image2\", mineType:\"image/jpeg\", data: imgData)\n\n```\n### `PUT` simple request\n```swift\nlet s = SWPut()\ns.responseDataType = SWResponseStringDataType()\ns.startDataTask(url: \"\", params:\"saman=test\" as AnyObject  , success: { (task, object) in\n    print(\"item\", object)\n}) { (task, error) in\n    print(\"error\", error)\n}\n```\n### `PATCH` simple request\n```swift\nlet s = SWPatch()\ns.responseDataType = SWResponseStringDataType()\ns.startDataTask(url: \"\", params:\"saman=test\" as AnyObject  , success: { (task, object) in\n    print(\"item\", object)\n}) { (task, error) in\n    print(\"error\", error)\n}\n\n```\n### `DELETE` simple request\n```swift\nlet s = SWDelete()\ns.responseDataType = SWResponseStringDataType()\ns.startDataTask(url: \"\", params:\"saman=test\" as AnyObject  , success: { (task, object) in\n    print(\"item\", object)\n}) { (task, error) in\n    print(\"error\", error)\n}\n\n```\n\n### `HEAD` simple request\n```swfit\nlet s = SWHead()\ns.responseDataType = SWResponseStringDataType()\ns.startDataTask(url: \"\", params:\"saman=test\" as AnyObject  , success: { (task, object) in\n    print(\"item\", object)\n}) { (task, error) in\n    print(\"error\", error)\n}\n```\n## Features\nall the following features averrable on all the request types. \neg : If you want to access you need to call relevant method that include cache block \n\n### Custom headers\nIf you want to add custom headers you can set to accessing request object.\n```swift\nlet s = SWPost()\ns.reqeust.setValue(\"application/x-www-form-urlencoded\", forHTTPHeaderField: \"Content-Type\")\ns.responseDataType = SWResponseStringDataType()\ns.startDataTask(url: \"\", params:[\"name\":\"this is name\", \"address\": \"your address\"] as AnyObject  , success: { (task, object) in\n    print(\"item\", object)\n}) { (task, error) in\n    print(\"error\", error)\n}\n```\n\n### Custom time out\nIf you want to change request timeout , you have to change property call `timeOut`.\n```swift\nlet s = SWPost()\ns.timeOut = 120\ns.responseDataType = SWResponseStringDataType()\ns.startDataTask(url: \"\", params:[\"name\":\"this is name\", \"address\": \"your address\"] as AnyObject  , success: { (task, object) in\n    print(\"item\", object)\n}) { (task, error) in\n    print(\"error\", error)\n}\n```\n\n### Response Encoding\nYou need to sent object type for the `responseDataType` on all your requests.\n\n```swift\n//JSON\nlet s = SWPost()\ns.responseDataType = SWResponseJSONDataType()\ns.startDataTask(url: \"\" , params: [\"name\":\"this is name for testing\", \"address\": \"your address\"] as AnyObject, parentView: nil, sendLaterIfOffline: true, cache: { (cache, response) in\n}, success: { (task, response) in\n}) { (task, error) in\n}\n\n//String\nlet s2 = SWPost()\ns2.responseDataType = SWResponseStringDataType()\ns2.startDataTask(url: \"\" , params: [\"name\":\"this is name for testing\", \"address\": \"your address\"] as AnyObject, parentView: nil, sendLaterIfOffline: true, cache: { (cache, response) in\n}, success: { (task, response) in\n}) { (task, error) in\n}\n```\n\n### `UIImageView` with `SkyWite`\nNo need to download image and set to `UIImageView` anymore. You can set url to `UIImageView`. \n\n```swift\n// Please use only one method . you can see 4 methods :)\n\nlet imageView = UIImageView.init(frame: CGRect(x:0, y:0, width:300, height:300))\nimageView.loadWithURLString(url: \"\")\nimageView.loadWithURLString(url: \"\", loadFromCacheFirst: true)\nimageView.loadWithURLString(url: \"\") { (image) in\n}\nimageView.loadWithURLString(url: \"\", loadFromCacheFirst: true) { (image) in\n}\n```\n\n### Check Reachability\nNew Reachability class to support block when change network status\navailable Status\n\n`NotReachable`\n`WWAN`\n`Wifi`\n\n```swift\nif (SWReachability.getCurrentNetworkStatus() == .NotReachable) {\n//connection not avaible\n}\n\n//if you want to get status chnage notification\nSWReachability.checkNetowrk(currentNetworkStatus: { (currentStatus) in\n}) { (changedStatus) in\n}\n\n```\n\n### Upload progress With Request\n\n```swift\nlet s = SWPost()\nlet image = UIImage(named: \"skywite\")\nlet imgData = UIImagePNGRepresentation(image!)\n\nlet media1 = SWMedia(fileName: \"imagefile.png\", key: \"image\", data: imgData!)\nlet media2 = SWMedia(fileName: \"imagefile.jpg\", key: \"image2\", mineType:\"image/jpeg\", data: imgData!)\n\ns.responseDataType = SWResponseStringDataType()\ns.startUploadTask(url: \"http://localhost:3000/api/v1/users/users\", files:[media1, media2] , params: [\"name\":\"this is name\", \"address\": \"your address\"] as AnyObject, success: { (task, object) in\n\n}) { (task, error) in\n\n}\nprogressView.setRequestForUpload(request: s)\n\n```\n\n### Download Progress With Request\n\n```swift\nlet s = SWPost()\ns.responseDataType = SWResponseJSONDataType()\ns.startDownloadTask(url: \"http://192.168.1.36:3000/api/v1/users/jobs\" , params:nil , parentView: nil, sendLaterIfOffline: true, cache: { (cache, response) in\n}, success: { (task, response) in\n}) { (task, error) in\n}\nprogressView.setRequestForDownload(request: s)\n```\n\n### Pass object to response block\n\nYou can set custom object to your request object as `userObject` . This will allow any type\n\n```swift\nlet s = SWPost()\ns.userObject = //any type object.\n\n```\n\n### Identify the Request\nYou can set `tag` for the request\n\n```swift\nlet s = SWPost()\ns.tag = 12;\n\n```\n\n### Offline request from `SkyWite`\n\nThis is really simple. First of all you need to send offline request expire time. this is seconds\n\n```swift\nSWOfflineManager.requestExpireTime(seconds: 1300)\n```\n\nYou have methods with parameter passing `sendLaterIfOllfine`. Just pass `YES`. That's it.\n\n```swift\nlet s = SWPost()\ns.responseDataType = SWResponseJSONDataType()\ns.startDownloadTask(url: \"http://192.168.1.36:3000/api/v1/users/jobs\" , params:nil , parentView: nil, sendLaterIfOffline: true, cache: { (cache, response) in\n}, success: { (task, response) in\n}) { (task, error) in\n}\n\n```\nIf you want catch offline request you need to use following methods. Better to add following lines to your `AppDelegate` didFinishLaunchingWithOptions methods.\n\n```swift\nSWOfflineManager.sharedInstance.request(success: { (squreqeust, obj) in\n}) { (request, error) in\n}\n```\n\nPlease note you need to set `tag` or `userObject` to identify the request. `userObject` should be `'NSCording' support object \n\n\n### Set Task for UIProgressView\nPlease use following method to set task for UIProgressView\n\n```swift\nfunc setDownloadTask(task: URLSessionDownloadTask) {}\nfunc setUploadTask(task: URLSessionUploadTask) {}\n```\n# Credits\n\n`SkyWite` is owned and maintained bye the [SkyWite](http://www.skywite.com)\n`SkyWite` was originally created by [saman kumara](http://www.isamankumara.com). If you want to contact [me@isamankuamra.com](mailto:me@isamankumara.com)\n\n# Security disclosure\n\nIf you believe you have identified a security vulnerability with `SkyWite`, you should report it as soon as possible via email to [me@isamankumara.com](mailto:me@isamankumara.com). Please do not post it to a public issue tracker.\n\n# License\n\n`Skywite` is released under the MIT license. See LICENSE for details.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisamankumara%2Fskywite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fisamankumara%2Fskywite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisamankumara%2Fskywite/lists"}