Remove storyboard and create UI from code

Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
Roopesh Chander 2018-08-11 13:19:21 +05:30
parent b6f4806fd6
commit 700c7221a9
6 changed files with 28 additions and 94 deletions

View File

@ -8,21 +8,19 @@
/* Begin PBXBuildFile section */
6FF4AC18211EC46F002C96EB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6FF4AC17211EC46F002C96EB /* AppDelegate.swift */; };
6FF4AC1A211EC46F002C96EB /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6FF4AC19211EC46F002C96EB /* ViewController.swift */; };
6FF4AC1D211EC46F002C96EB /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6FF4AC1B211EC46F002C96EB /* Main.storyboard */; };
6FF4AC1F211EC472002C96EB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6FF4AC1E211EC472002C96EB /* Assets.xcassets */; };
6FF4AC22211EC472002C96EB /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6FF4AC20211EC472002C96EB /* LaunchScreen.storyboard */; };
6FF4AC2F211F1F57002C96EB /* MainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6FF4AC2E211F1F57002C96EB /* MainViewController.swift */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
6FF4AC14211EC46F002C96EB /* WireGuard.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = WireGuard.app; sourceTree = BUILT_PRODUCTS_DIR; };
6FF4AC17211EC46F002C96EB /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
6FF4AC19211EC46F002C96EB /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
6FF4AC1C211EC46F002C96EB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
6FF4AC1E211EC472002C96EB /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
6FF4AC21211EC472002C96EB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
6FF4AC23211EC472002C96EB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
6FF4AC2B211EC776002C96EB /* Developer.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Developer.xcconfig; path = Config/Developer.xcconfig; sourceTree = "<group>"; };
6FF4AC2E211F1F57002C96EB /* MainViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainViewController.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -56,8 +54,7 @@
isa = PBXGroup;
children = (
6FF4AC17211EC46F002C96EB /* AppDelegate.swift */,
6FF4AC19211EC46F002C96EB /* ViewController.swift */,
6FF4AC1B211EC46F002C96EB /* Main.storyboard */,
6FF4AC2E211F1F57002C96EB /* MainViewController.swift */,
6FF4AC1E211EC472002C96EB /* Assets.xcassets */,
6FF4AC20211EC472002C96EB /* LaunchScreen.storyboard */,
6FF4AC23211EC472002C96EB /* Info.plist */,
@ -126,7 +123,6 @@
files = (
6FF4AC22211EC472002C96EB /* LaunchScreen.storyboard in Resources */,
6FF4AC1F211EC472002C96EB /* Assets.xcassets in Resources */,
6FF4AC1D211EC46F002C96EB /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -137,22 +133,14 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
6FF4AC1A211EC46F002C96EB /* ViewController.swift in Sources */,
6FF4AC18211EC46F002C96EB /* AppDelegate.swift in Sources */,
6FF4AC2F211F1F57002C96EB /* MainViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
6FF4AC1B211EC46F002C96EB /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
6FF4AC1C211EC46F002C96EB /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
6FF4AC20211EC472002C96EB /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (

View File

@ -13,34 +13,16 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
let window = UIWindow(frame: UIScreen.main.bounds)
window.backgroundColor = UIColor.white
self.window = window
window.rootViewController = MainViewController()
window.makeKeyAndVisible()
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}

View File

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" systemVersion="17A277" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>

View File

@ -22,8 +22,6 @@
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>

View File

@ -0,0 +1,15 @@
//
// MainViewController.swift
// WireGuard
//
// Created by Roopesh Chander on 11/08/18.
// Copyright © 2018 Roopesh Chander. All rights reserved.
//
import UIKit
class MainViewController: UIViewController {
override func loadView() {
self.view = UIView()
}
}

View File

@ -1,25 +0,0 @@
//
// ViewController.swift
// WireGuard
//
// Created by Roopesh Chander on 11/08/18.
// Copyright © 2018 Roopesh Chander. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}