Skip to content

Commit

Permalink
Display a single counter value
Browse files Browse the repository at this point in the history
  • Loading branch information
eunikolsky committed Nov 20, 2021
1 parent 8003007 commit dba744d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 24 deletions.
8 changes: 4 additions & 4 deletions UIKit-to-SwiftUI.xcodeproj/project.pbxproj
Expand Up @@ -13,7 +13,7 @@
14D2E4D42742E2EC0043AC2B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 14D2E4D22742E2EC0043AC2B /* Main.storyboard */; };
14D2E4D62742E2ED0043AC2B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 14D2E4D52742E2ED0043AC2B /* Assets.xcassets */; };
14D2E4D92742E2ED0043AC2B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 14D2E4D72742E2ED0043AC2B /* LaunchScreen.storyboard */; };
14D2E4E2274429090043AC2B /* SwiftUIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14D2E4E1274429090043AC2B /* SwiftUIView.swift */; };
14D2E4E2274429090043AC2B /* CounterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14D2E4E1274429090043AC2B /* CounterView.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -26,7 +26,7 @@
14D2E4D52742E2ED0043AC2B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
14D2E4D82742E2ED0043AC2B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
14D2E4DA2742E2ED0043AC2B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
14D2E4E1274429090043AC2B /* SwiftUIView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftUIView.swift; sourceTree = "<group>"; };
14D2E4E1274429090043AC2B /* CounterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CounterView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -67,7 +67,7 @@
14D2E4D52742E2ED0043AC2B /* Assets.xcassets */,
14D2E4D72742E2ED0043AC2B /* LaunchScreen.storyboard */,
14D2E4DA2742E2ED0043AC2B /* Info.plist */,
14D2E4E1274429090043AC2B /* SwiftUIView.swift */,
14D2E4E1274429090043AC2B /* CounterView.swift */,
);
path = "UIKit-to-SwiftUI";
sourceTree = "<group>";
Expand Down Expand Up @@ -144,7 +144,7 @@
files = (
14D2E4D12742E2EC0043AC2B /* ViewController.swift in Sources */,
14D2E4CD2742E2EC0043AC2B /* AppDelegate.swift in Sources */,
14D2E4E2274429090043AC2B /* SwiftUIView.swift in Sources */,
14D2E4E2274429090043AC2B /* CounterView.swift in Sources */,
14D2E4CF2742E2EC0043AC2B /* SceneDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
25 changes: 25 additions & 0 deletions UIKit-to-SwiftUI/CounterView.swift
@@ -0,0 +1,25 @@
//
// CounterView.swift
// UIKit-to-SwiftUI
//
// Created by u on 16.11.21.
//

import SwiftUI

struct CounterView: View {
var counter = 0

var body: some View {
Text("Counter: \(counter)")
}
}

struct SwiftUIView_Previews: PreviewProvider {
static var previews: some View {
ForEach([0, 42], id: \.self) { counter in
CounterView(counter: counter)
.previewLayout(.fixed(width: 200, height: 100))
}
}
}
20 changes: 0 additions & 20 deletions UIKit-to-SwiftUI/SwiftUIView.swift

This file was deleted.

0 comments on commit dba744d

Please sign in to comment.