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 prefs:NSUserDefaults = NSUserDefaults.standardUserDefaults() | |
| import UIKit | |
| import Alamofire | |
| class LoginViewController: UIViewController,UITextFieldDelegate { | |
| @IBOutlet var txtUsername : UITextField! | |
| @IBOutlet var txtPassword : UITextField! | |
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 token = prefs.valueForKey("SESSIONID") as? String | |
| let session = NSURLSession.sharedSession() | |
| let url = NSURL(string: "http://xxxxxxxxxx.com:2403/users/me") | |
| let request = NSMutableURLRequest(URL: url!) | |
| request.HTTPMethod = "GET" | |
| request.setValue( "Bearer \(token!)", forHTTPHeaderField: "Authorization") | |
| let task = session.dataTaskWithRequest(request, completionHandler: {data, response, error -> Void in | |
| if (data != nil) { | |
| let res = response as! NSHTTPURLResponse!; |
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
| { | |
| "type": "UserCollection", | |
| "properties": { | |
| "socialAccount": { | |
| "name": "socialAccount", | |
| "type": "string", | |
| "typeLabel": "string", | |
| "required": false, | |
| "id": "socialAccount", | |
| "order": 0 |
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
| import UIKit | |
| class ViewController: UIViewController, UIWebViewDelegate { | |
| var webView: UIWebView! | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| // Do any additional setup after loading the view, typically from a nib. | |
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 session = NSURLSession.sharedSession() | |
| let url = NSURL(string: "http://someurl.com") | |
| let request = NSMutableURLRequest(URL: url!) | |
| request.HTTPMethod = "GET" | |
| let task = session.dataTaskWithRequest(request, completionHandler: {data, response, error -> Void in | |
| if (data != nil) { | |
| let res = response as! NSHTTPURLResponse!; | |
| if 200..<300 ~= res.statusCode { |
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
| var smtpSession = MCOSMTPSession() | |
| smtpSession.hostname = "HOSTNAME" | |
| smtpSession.username = "USERNAME" | |
| smtpSession.password = "PASSWORD" | |
| smtpSession.port = PORT | |
| smtpSession.authType = MCOAuthType.SASLPlain | |
| smtpSession.connectionType = MCOConnectionType.TLS | |
| smtpSession.connectionLogger = {(connectionID, type, data) in | |
| if data != nil { | |
| if let string = NSString(data: data, encoding: NSUTF8StringEncoding){ |
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 prefs:NSUserDefaults = NSUserDefaults.standardUserDefaults() //make this global | |
| // Mark: This is how you save. | |
| prefs.setObject("\(someVariable)", forKey: "PORT") | |
| prefs.synchronize() | |
| //Mark: This is how you retrieve saved content. | |
| let retrieve = prefs.valueForKey("PORT") as? String | |
| print(retrieve) |
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
| // | |
| // UILabelDeviceClass.swift | |
| // | |
| // Created by MyCandy on 01/01/19. | |
| // Copyright © 2019 Silver Seahog. All rights reserved. | |
| // | |
| import Foundation | |
| import UIKit |
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 BottomBorderTF: UITextField { | |
| var bottomBorder = UIView() | |
| override func awakeFromNib() { | |
| //MARK: Setup Bottom-Border | |
| self.translatesAutoresizingMaskIntoConstraints = false | |
| bottomBorder = UIView.init(frame: CGRect(x: 0, y: 0, width: 0, height: 0)) | |
| bottomBorder.backgroundColor = UIColor.orange | |
| bottomBorder.translatesAutoresizingMaskIntoConstraints = false |
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
| var smtpSession = MCOSMTPSession() | |
| smtpSession.hostname = "" | |
| smtpSession.username = "" | |
| smtpSession.password = "" | |
| smtpSession.timeout = 5 | |
| smtpSession.port = UInt32(port!)! | |
| smtpSession.authType = MCOAuthType.saslPlain | |
| smtpSession.connectionType = MCOConnectionType.startTLS | |
| smtpSession.connectionLogger = {(connectionID, type, data) in | |
| if data != nil { |
OlderNewer