Skip to content

Commit

Permalink
Move view configuration to separated view file
Browse files Browse the repository at this point in the history
  • Loading branch information
Emerson Mendes Filho committed May 21, 2021
1 parent 9007c71 commit 6fb1c12
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
4 changes: 4 additions & 0 deletions ViewCodeGuide/ViewCodeGuide.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
C69E436826582D9C004E30A6 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C69E436626582D9C004E30A6 /* LaunchScreen.storyboard */; };
C69E437326582D9C004E30A6 /* ViewCodeGuideTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C69E437226582D9C004E30A6 /* ViewCodeGuideTests.swift */; };
C69E437E26582D9D004E30A6 /* ViewCodeGuideUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C69E437D26582D9D004E30A6 /* ViewCodeGuideUITests.swift */; };
C69E43AD26583B52004E30A6 /* MyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C69E43AC26583B52004E30A6 /* MyView.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -47,6 +48,7 @@
C69E437926582D9D004E30A6 /* ViewCodeGuideUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ViewCodeGuideUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
C69E437D26582D9D004E30A6 /* ViewCodeGuideUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewCodeGuideUITests.swift; sourceTree = "<group>"; };
C69E437F26582D9D004E30A6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
C69E43AC26583B52004E30A6 /* MyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -136,6 +138,7 @@
isa = PBXGroup;
children = (
C69E435F26582D94004E30A6 /* ViewController.swift */,
C69E43AC26583B52004E30A6 /* MyView.swift */,
);
path = Source;
sourceTree = "<group>";
Expand Down Expand Up @@ -278,6 +281,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C69E43AD26583B52004E30A6 /* MyView.swift in Sources */,
C69E436026582D94004E30A6 /* ViewController.swift in Sources */,
C69E435C26582D94004E30A6 /* AppDelegate.swift in Sources */,
C69E435E26582D94004E30A6 /* SceneDelegate.swift in Sources */,
Expand Down
21 changes: 21 additions & 0 deletions ViewCodeGuide/ViewCodeGuide/Source/MyView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// MyView.swift
// ViewCodeGuide
//
// Created by Emerson Mendes Filho on 21/05/21.
//

import UIKit

final class MyView: UIView {

init() {
super.init(frame: .zero)
self.backgroundColor = .orange
}

@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
4 changes: 1 addition & 3 deletions ViewCodeGuide/ViewCodeGuide/Source/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ class ViewController: UIViewController {
}

override func loadView() {
let view = UIView(frame: .zero)
view.backgroundColor = .orange
self.view = view
self.view = MyView()
}
}

0 comments on commit 6fb1c12

Please sign in to comment.