This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let url = URL(string: "http://0.0.0.0")! | |
| let data = "Secret Message".data(using: .utf8) | |
| let request = URLRequest(url: url) | |
| let task = URLSession.shared.uploadTask(with: request, from: data) { responseData, response, error in | |
| print("We're done here") | |
| } | |
| task.resume() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let url = URL(string: "http://0.0.0.0")! | |
| let data = "Secret Message".data(using: .utf8) | |
| let request = URLRequest(url: url) | |
| let config = URLSessionConfiguration.background(withIdentifier: "uniqueId") | |
| let session = URLSession(configuration: config, delegate: nil, delegateQueue: nil) | |
| let task = session.uploadTask(with: request, from: data) { responseData, response, error in | |
| print("We're done here") | |
| } | |
| task.resume() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ViewController: UIViewController, URLSessionTaskDelegate { | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| let url = URL(string: "http://0.0.0.0")! | |
| let data = "Secret Message".data(using: .utf8)! | |
| let request = URLRequest(url: url) | |
| let config = URLSessionConfiguration.background(withIdentifier: "uniqueId") | |
| let session = URLSession(configuration: config, delegate: self, delegateQueue: nil) | |
| let task = session.uploadTask(with: request, from: data) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ViewController: UIViewController, URLSessionTaskDelegate { | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| let url = URL(string: "http://0.0.0.0")! | |
| let data = "Secret Message".data(using: .utf8)! | |
| let tempDir = FileManager.default.temporaryDirectory | |
| let localURL = tempDir.appendingPathComponent("throwaway") | |
| try? data.write(to: localURL) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct SwiftStructForiOSThatContainsUserAgeData { | |
| let age: Int | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| protocol UserStoreController { | |
| func getAllUsers() -> [User] | |
| func getUser(_ id: String) -> User | |
| func openProfile(_ user: User) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {% macro methodSig method %} | |
| func {{ method.name }} | |
| {% if method.returnTypeName|!contains:"Void" %} -> {{method.returnTypeName}}{% endif %} | |
| {% endmacro %} | |
| {% for type in types.protocols %} | |
| // sourcery:file:Mock{{ type.name }}.swift | |
| import Foundation | |
| class Mock{{ type.name }}: {{ type.name }} { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MockHasFancy: HasFancy { | |
| func rockAndRoll() { | |
| } | |
| func secondMethod() -> Int { | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Generated using Sourcery 0.15.0 — https://github.com/krzysztofzablocki/Sourcery | |
| // DO NOT EDIT | |
| import Foundation | |
| protocol HasFancy { | |
| func rockAndRoll() | |
| func secondMethod() -> Int | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| UIModalPresentationStyle | iPhone | iPad | |
|---|---|---|---|
| .fullScreen | YES | YES | |
| .pageSheet | YES | NO | |
| .formSheet | YES | NO | |
| .currentContext | YES | YES | |
| .custom | NO | NO | |
| .overFullScreen | NO | NO | |
| .overCurrentContext | NO | NO | |
| .blurOverFullScreen | only on tvOS - N/A | N/A | |
| .popover | YES | NO |