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,
// 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"
urlRequest.httpBody = try params, options:[])

set image button

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) {

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

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
python Content


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


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