Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 29 additions & 24 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,28 @@
archiveVersion = 1;
classes = {
};
objectVersion = 52;
objectVersion = 60;
objects = {

/* Begin PBXBuildFile section */
BE65305F2B05D59900922369 /* Focuser in Frameworks */ = {isa = PBXBuildFile; productRef = BE65305E2B05D59900922369 /* Focuser */; };
BE6530612B05DD0800922369 /* TextEditorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE6530602B05DD0800922369 /* TextEditorView.swift */; };
BE6530632B05E2E800922369 /* TextFieldView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE6530622B05E2E800922369 /* TextFieldView.swift */; };
BE6530652B05E2FB00922369 /* RootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE6530642B05E2FB00922369 /* RootView.swift */; };
FFDC73A326DF94DC00C1F0D0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFDC73A226DF94DC00C1F0D0 /* AppDelegate.swift */; };
FFDC73A526DF94DC00C1F0D0 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFDC73A426DF94DC00C1F0D0 /* SceneDelegate.swift */; };
FFDC73A726DF94DC00C1F0D0 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFDC73A626DF94DC00C1F0D0 /* ContentView.swift */; };
FFDC73A926DF94DE00C1F0D0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FFDC73A826DF94DE00C1F0D0 /* Assets.xcassets */; };
FFDC73AC26DF94DE00C1F0D0 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FFDC73AB26DF94DE00C1F0D0 /* Preview Assets.xcassets */; };
FFDC73AF26DF94DE00C1F0D0 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FFDC73AD26DF94DE00C1F0D0 /* LaunchScreen.storyboard */; };
FFDC73C626DFE61F00C1F0D0 /* Focuser in Frameworks */ = {isa = PBXBuildFile; productRef = FFDC73C526DFE61F00C1F0D0 /* Focuser */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
FF8D789526E1FC33006287E9 /* swift-focuser */ = {isa = PBXFileReference; lastKnownFileType = folder; name = "swift-focuser"; path = ..; sourceTree = "<group>"; };
BE6530602B05DD0800922369 /* TextEditorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextEditorView.swift; sourceTree = "<group>"; };
BE6530622B05E2E800922369 /* TextFieldView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextFieldView.swift; sourceTree = "<group>"; };
BE6530642B05E2FB00922369 /* RootView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootView.swift; sourceTree = "<group>"; };
FFDC739F26DF94DC00C1F0D0 /* focusstate.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = focusstate.app; sourceTree = BUILT_PRODUCTS_DIR; };
FFDC73A226DF94DC00C1F0D0 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
FFDC73A426DF94DC00C1F0D0 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
FFDC73A626DF94DC00C1F0D0 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
FFDC73A826DF94DE00C1F0D0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
FFDC73AB26DF94DE00C1F0D0 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
FFDC73AE26DF94DE00C1F0D0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
Expand All @@ -33,7 +36,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FFDC73C626DFE61F00C1F0D0 /* Focuser in Frameworks */,
BE65305F2B05D59900922369 /* Focuser in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -43,7 +46,6 @@
FFDC739626DF94DC00C1F0D0 = {
isa = PBXGroup;
children = (
FF8D789526E1FC33006287E9 /* swift-focuser */,
FFDC73A126DF94DC00C1F0D0 /* focusstate */,
FFDC73A026DF94DC00C1F0D0 /* Products */,
);
Expand All @@ -62,7 +64,9 @@
children = (
FFDC73A226DF94DC00C1F0D0 /* AppDelegate.swift */,
FFDC73A426DF94DC00C1F0D0 /* SceneDelegate.swift */,
FFDC73A626DF94DC00C1F0D0 /* ContentView.swift */,
BE6530642B05E2FB00922369 /* RootView.swift */,
BE6530622B05E2E800922369 /* TextFieldView.swift */,
BE6530602B05DD0800922369 /* TextEditorView.swift */,
FFDC73A826DF94DE00C1F0D0 /* Assets.xcassets */,
FFDC73AD26DF94DE00C1F0D0 /* LaunchScreen.storyboard */,
FFDC73B026DF94DE00C1F0D0 /* Info.plist */,
Expand Down Expand Up @@ -96,7 +100,7 @@
);
name = focusstate;
packageProductDependencies = (
FFDC73C526DFE61F00C1F0D0 /* Focuser */,
BE65305E2B05D59900922369 /* Focuser */,
);
productName = focusstate;
productReference = FFDC739F26DF94DC00C1F0D0 /* focusstate.app */;
Expand Down Expand Up @@ -126,7 +130,7 @@
);
mainGroup = FFDC739626DF94DC00C1F0D0;
packageReferences = (
FFDC73C426DFE61F00C1F0D0 /* XCRemoteSwiftPackageReference "swift-focuser" */,
BE65305D2B05D59900922369 /* XCLocalSwiftPackageReference ".." */,
);
productRefGroup = FFDC73A026DF94DC00C1F0D0 /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -156,8 +160,10 @@
buildActionMask = 2147483647;
files = (
FFDC73A326DF94DC00C1F0D0 /* AppDelegate.swift in Sources */,
BE6530632B05E2E800922369 /* TextFieldView.swift in Sources */,
FFDC73A526DF94DC00C1F0D0 /* SceneDelegate.swift in Sources */,
FFDC73A726DF94DC00C1F0D0 /* ContentView.swift in Sources */,
BE6530612B05DD0800922369 /* TextEditorView.swift in Sources */,
BE6530652B05E2FB00922369 /* RootView.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -298,13 +304,15 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"focusstate/Preview Content\"";
DEVELOPMENT_TEAM = RLK76T8Y89;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = focusstate/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = at.focusstate;
PRODUCT_BUNDLE_IDENTIFIER = org.c61a76ee8f8cc7af.focusstate;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
Expand All @@ -318,13 +326,15 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"focusstate/Preview Content\"";
DEVELOPMENT_TEAM = RLK76T8Y89;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = focusstate/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = at.focusstate;
PRODUCT_BUNDLE_IDENTIFIER = org.c61a76ee8f8cc7af.focusstate;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
Expand Down Expand Up @@ -354,21 +364,16 @@
};
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
FFDC73C426DFE61F00C1F0D0 /* XCRemoteSwiftPackageReference "swift-focuser" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "git@github.com:art-technologies/swift-focuser.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 0.1.0;
};
/* Begin XCLocalSwiftPackageReference section */
BE65305D2B05D59900922369 /* XCLocalSwiftPackageReference ".." */ = {
isa = XCLocalSwiftPackageReference;
relativePath = ..;
};
/* End XCRemoteSwiftPackageReference section */
/* End XCLocalSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
FFDC73C526DFE61F00C1F0D0 /* Focuser */ = {
BE65305E2B05D59900922369 /* Focuser */ = {
isa = XCSwiftPackageProductDependency;
package = FFDC73C426DFE61F00C1F0D0 /* XCRemoteSwiftPackageReference "swift-focuser" */;
productName = Focuser;
};
/* End XCSwiftPackageProductDependency section */
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

74 changes: 0 additions & 74 deletions Example/focusstate/ContentView.swift

This file was deleted.

28 changes: 28 additions & 0 deletions Example/focusstate/RootView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// RootView.swift
// focusstate
//
// Created by will on 2023/11/16.
//

import SwiftUI

struct RootView: View {
var body: some View {
NavigationView {
List {
NavigationLink(destination: TextFieldView()) {
Text("TextField")
}
NavigationLink(destination: TextEditorView()) {
Text("TextEditor")
}
}
.navigationTitle("All Examples")
}
}
}

#Preview {
RootView()
}
2 changes: 1 addition & 1 deletion Example/focusstate/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).

// Create the SwiftUI view that provides the window contents.
let contentView = ContentView()
let contentView = RootView()

// Use a UIHostingController as window root view controller.
if let windowScene = scene as? UIWindowScene {
Expand Down
34 changes: 34 additions & 0 deletions Example/focusstate/TextEditorView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// TextEditorView.swift
// focusstate
//
// Created by will on 2023/11/16.
//

import Focuser
import SwiftUI

struct TextEditorView: View {
enum FormFields: FocusStateCompliant {
case textEditor

static var last: Self { .textEditor }
var next: Self? { nil }
}

@FocusStateLegacy var focusedField: FormFields?
@State var text = "Edit me!"

var body: some View {
TextEditor(text: $text)
.padding()
.background(Color(.systemGray6))
.cornerRadius(20)
.padding()
.focusedLegacy($focusedField, equals: .textEditor)
}
}

#Preview {
TextEditorView()
}
68 changes: 68 additions & 0 deletions Example/focusstate/TextFieldView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
//
// TextFieldView.swift
// focusstate
//
// Created by Augustinas Malinauskas on 01/09/2021.
//

import Focuser
import SwiftUI

struct TextFieldView: View {
enum FormFields: FocusStateCompliant {
case username, password, name
static var last: FormFields {
.name
}

var next: FormFields? {
switch self {
case .username:
return .password
case .password:
return .name
default: return nil
}
}
}

@FocusStateLegacy var focusedField: FormFields?
@State var username = ""
@State var password = ""
@State var name = ""

var body: some View {
VStack {
TextField("Username", text: $username)
.padding(9)
.background(Color(.systemGray6))
.cornerRadius(8)
.focusedLegacy($focusedField, equals: .username)

TextField("Password", text: $password)
.padding(9)
.background(Color(.systemGray6))
.cornerRadius(8)
.focusedLegacy($focusedField, equals: .password)

TextField("Name", text: $name)
.padding(9)
.background(Color(.systemGray6))
.cornerRadius(8)
.focusedLegacy($focusedField, equals: .name)

Button(action: {
focusedField = FormFields.password
}) {
Text("Focus Password")
}
}
.padding()
}
}

struct ContentView_Previews: PreviewProvider {
static var previews: some View {
TextFieldView()
}
}
Loading