Last active
August 29, 2015 14:15
-
-
Save matsuhisa/b0a9b54df51fe6491211 to your computer and use it in GitHub Desktop.
Xcode6(Swift)で1つのプロジェクトから開発版とリリース版の2つのアプリを作りたい ref: http://qiita.com/matsuhisa@github/items/3f4e1ba0f05a69076dde
This file contains 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
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { | |
// Override point for customization after application launch. | |
let splitViewController = self.window!.rootViewController as ViewController | |
let size = CGSize(width: splitViewController.view.frame.size.width, height: 50) | |
let postion:CGPoint = CGPoint(x: 0, y: splitViewController.view.frame.size.height-50.0) | |
let view:UIView = UIView(frame: CGRect(origin: postion, size: size)) | |
#if DEBUG | |
view.backgroundColor = UIColor(red: 255, green: 0.0, blue: 0.0, alpha: 0.5) | |
#else | |
view.backgroundColor = UIColor(red: 138, green: 138, blue:0, alpha: 1) | |
#endif | |
let devInfoLabel = UILabel() | |
devInfoLabel.text = "開発版:" + Constants().MESSEAGE | |
devInfoLabel.font = UIFont.systemFontOfSize(14) | |
devInfoLabel.frame = CGRect(origin: CGPoint(x: 10, y: splitViewController.view.frame.size.height-50.0), size: size) | |
splitViewController.view.addSubview(view) | |
splitViewController.view.addSubview(devInfoLabel) | |
return true | |
} | |
This file contains 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 Foundation | |
class Constants:NSObject { | |
#if DEBUG | |
let MESSEAGE = "こんにちは(開発中です)" | |
#else | |
let MESSEAGE = "こんにちは" | |
#endif | |
} |
This file contains 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
TARGETS > Build Settings > Swift Compiler - Custom Flags > Other Swift Flags |
This file contains 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
-D DEBUG |
This file contains 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 { | |
@IBOutlet weak var LabelMessage: UILabel! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
LabelMessage.text = Constants().MESSEAGE | |
println(Constants().MESSEAGE) | |
} | |
override func didReceiveMemoryWarning() { | |
super.didReceiveMemoryWarning() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment