iOrder Qrcode

out line swift 3

func createAttributedString(string: String,size:CGFloat) -> NSMutableAttributedString {
let font = UIFont(name: "Futura-Medium", size: size)
let textAttributes = [
NSFontAttributeName : font!,
// Note: SKColor.whiteColor().CGColor breaks this
NSForegroundColorAttributeName: UIColor.white,
NSStrokeColorAttributeName: UIColor.black,
// Note: Use negative value here if you want foreground color to show
NSStrokeWidthAttributeName: -3

add header for alamofire

var urlRequest = URLRequest(url: URL(string: APIManager.baseURLString + result)!)
var token: String = "noToken"
if KeychainSwift().get(TOKEN) != nil {
token = KeychainSwift().get(TOKEN)!
}
urlRequest.httpMethod = method.rawValue
urlRequest.setValue(token, forHTTPHeaderField: "Authorization")

fatal: Unable to create '/Users/mhtran/iorder-x/.git/index.lock': File exists. If no other git process is currently running, this probably means a git process crashed in this repository earlier. Make sure no other git process is running and remove the fil

rm -f ./.git/index.lock

body with alamofire 4 swift 3

static func updateMenu(_ idMenu:String,params:[String:String],callBack:@escaping (_ check:Int,_ result:String,_ data:JSON,_ meta:JSON) -> Void){

let url = URL(string:APIManager.baseURLString + "menus/\(idMenu)?access_token=\(KeychainSwift().get(TOKEN)!)")
var urlRequest = URLRequest(url: url!)
urlRequest.httpMethod = "PUT"
do{
urlRequest.httpBody = try JSONSerialization.data(withJSONObject: params, options:[])
}catch{

set image button

backButton.setImage(
UIImage(named: "arrow.png"),
inFrame: CGRect(x: 40, y: 40, width: 18, height: 18),
forState: UIControlState()
)

CGRectMake in swift 3 is removed.

extension CGRect{
init(_ x:CGFloat,_ y:CGFloat,_ width:CGFloat,_ height:CGFloat) {
self.init(x:x,y:y,width:width,height:height)
}

}
extension CGSize{
init(_ width:CGFloat,_ height:CGFloat) {
self.init(width:width,height:height)
}
}
extension CGPoint{
init(_ x:CGFloat,_ y:CGFloat) {
self.init(x:x,y:y)
}
}

Then go to "Find and Replace in Workspace" Find CGRectMake , CGPointMake, CGSizeMake and Replace them with CGRect , CGPoint, CGSize

upload Image on swift 3

static func uploadImageItem(_ idItem:String,imgage:UIImageView,callBack:@escaping (_ check:Int,_ result:String,_ data:JSON,_ meta:JSON) -> Void){
let urlRequest = URL(string:APIManager.baseURLString + "items/\(idItem)/upload?access_token=\(KeychainSwift().get(TOKEN)!)")
Alamofire.upload(multipartFormData: { (multipartFormData) in
if let imageData = imgage.image?.resizeToWidth(1024).highQualityJPEGNSData {
multipartFormData.append(imageData, withName: "image", fileName: "file.jpg", mimeType: "image/jpg")

Xcode xip

Verify the signature and certificate chain that signed the archive.
pkgutil --verbose --check-signature ./Xcode_8_GM_seed.xip
Extract the PBZX stream from the archive.
xar -xf ./Xcode_8_GM_seed.xip
Obtain a PBZX v2 unpacker and... unpack the packed stuff.
curl -O https://gist.githubusercontent.com/pudquick/ff412bcb29c9c1fa4b8d/raw/24b...
python parse_pbzx2.py Content

rootviewcontroller

let mainStoryBoard = UIStoryboard(name: "Main", bundle: nil)
let vc = mainStoryBoard.instantiateViewControllerWithIdentifier("KYDrawerController") as! KYDrawerController
let nav = UINavigationController(rootViewController: vc)
self.app!.window?.rootViewController = nav

Pages

Subscribe to Trần Mạnh Hoàng RSS