Skip to content

Commit

Permalink
Merge pull request #10 from KaitoMuraoka/feature/issue-7
Browse files Browse the repository at this point in the history
TipsKit の追加
  • Loading branch information
KaitoMuraoka authored Jul 8, 2024
2 parents 455c7ba + 74d788c commit 087978c
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 3 deletions.
4 changes: 4 additions & 0 deletions PasswordBox.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
3F99FC592C39258B001ED4B2 /* Entry.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F99FC582C39258B001ED4B2 /* Entry.swift */; };
3FC77A5F2C313B5900B56E75 /* SettingIconView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FC77A5E2C313B5900B56E75 /* SettingIconView.swift */; };
3FC77A612C313C4500B56E75 /* IconView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FC77A602C313C4500B56E75 /* IconView.swift */; };
3FEE0F162C3C2EDE0057EE2F /* AppTips.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FEE0F152C3C2EDE0057EE2F /* AppTips.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -88,6 +89,7 @@
3F99FC582C39258B001ED4B2 /* Entry.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Entry.swift; sourceTree = "<group>"; };
3FC77A5E2C313B5900B56E75 /* SettingIconView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingIconView.swift; sourceTree = "<group>"; };
3FC77A602C313C4500B56E75 /* IconView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IconView.swift; sourceTree = "<group>"; };
3FEE0F152C3C2EDE0057EE2F /* AppTips.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppTips.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -287,6 +289,7 @@
3F99FC4E2C390873001ED4B2 /* Images.swift */,
3F99FC502C390D65001ED4B2 /* IconStyles.swift */,
3F026F432C3A789500ED696C /* URLs.swift */,
3FEE0F152C3C2EDE0057EE2F /* AppTips.swift */,
);
path = Resources;
sourceTree = "<group>";
Expand Down Expand Up @@ -435,6 +438,7 @@
3F026F272C399A4100ED696C /* PasswordKeychain.swift in Sources */,
3F13F9C62C1DECF30068908E /* InfomationViewModel.swift in Sources */,
3F13F9CB2C1DEE020068908E /* PasswordFormView.swift in Sources */,
3FEE0F162C3C2EDE0057EE2F /* AppTips.swift in Sources */,
3F026F442C3A789500ED696C /* URLs.swift in Sources */,
3F99FC512C390D65001ED4B2 /* IconStyles.swift in Sources */,
3F8C85C72C189F230032277E /* CellView.swift in Sources */,
Expand Down
13 changes: 13 additions & 0 deletions PasswordBox/Resources/AppTips.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import TipKit

struct AppTips {
struct ChangeIcon: Tip {
var title: Text {
Text("アイコンとタイトルを変更")
}
var message: Text? {
Text("アイコンとタイトルはこちらから編集することができます。")
}
}

}
11 changes: 9 additions & 2 deletions PasswordBox/UI/Common/PasswordFormView.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import SwiftUI
import TipKit

struct PasswordFormView: View {
@Binding var title: String
Expand Down Expand Up @@ -30,12 +31,12 @@ struct PasswordFormView: View {
.sheet(isPresented: $isShowingIconView, content: {
SettingIconView(title: $title, iconString: $iconString)
})
.popoverTip(AppTips.ChangeIcon())
}
.padding(.bottom, 20)

Text("Password")
.font(.title)
PasswordField("PasswordField", text: $passwordString)
.padding()

Button(action: {
print("更新します")
Expand Down Expand Up @@ -75,5 +76,11 @@ struct PasswordFormView: View {
.padding(.horizontal, 20)
}
}
.task {
try? Tips.configure([
.displayFrequency(.immediate),
.datastoreLocation(.applicationDefault),
])
}
}
}
1 change: 1 addition & 0 deletions PasswordBox/UI/Info/InfomationView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ struct InfomationView: View {
LabeledContent("バージョン", value: viewModel.versionString)
}
}
.navigationTitle("アプリ情報")
}
}

Expand Down
8 changes: 7 additions & 1 deletion PasswordBox/UI/List/Add/AddView.swift
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import SwiftUI
import SwiftData
import TipKit

struct AddView: View {
@State private var title: String = "sample"
@State private var iconString: String = "key"
@State private var passwordString: String = "SamplePassword"
@State private var passwordString: String = ""
@State private var passwordLength: Int = 4
@Environment(\.modelContext) private var context
@Environment(\.dismiss) private var dismiss
private let viewModel = AddViewModel()

var body: some View {
NavigationStack {
PasswordFormView(title: $title, iconString: $iconString, passwordString: $passwordString, passwordLength: $passwordLength)
Expand All @@ -28,6 +30,10 @@ struct AddView: View {
}
}
}
.onAppear {
self.passwordString = CreatePassword.createPassword(length: passwordLength, true, true)
self.passwordLength = passwordString.count
}
}
}

Expand Down

0 comments on commit 087978c

Please sign in to comment.