Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【FEAT】 support iOS16 #105

Merged
merged 3 commits into from
May 5, 2024
Merged
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
14 changes: 11 additions & 3 deletions discord-bot-helper.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/* Begin PBXBuildFile section */
4F0758202BE81F2D0064A30F /* GoogleMobileAds in Frameworks */ = {isa = PBXBuildFile; productRef = 4F07581F2BE81F2D0064A30F /* GoogleMobileAds */; };
4F0EC95A2BD1A2C3009A5CB6 /* Alamofire in Frameworks */ = {isa = PBXBuildFile; productRef = 4F0EC9592BD1A2C3009A5CB6 /* Alamofire */; };
4F3A7B552BE836BF0046765E /* Extension+View.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F3A7B542BE836BF0046765E /* Extension+View.swift */; };
4F435C8E2BE115650087CEE3 /* MainView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F435C8D2BE115650087CEE3 /* MainView.swift */; };
4F435C902BE117840087CEE3 /* SettingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F435C8F2BE117840087CEE3 /* SettingView.swift */; };
4F5072B82BCF901E0005D352 /* discord_bot_helperApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F5072B72BCF901E0005D352 /* discord_bot_helperApp.swift */; };
Expand All @@ -35,6 +36,7 @@

/* Begin PBXFileReference section */
4F2CDC502BD31B4A000DF626 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
4F3A7B542BE836BF0046765E /* Extension+View.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Extension+View.swift"; sourceTree = "<group>"; };
4F435C8D2BE115650087CEE3 /* MainView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainView.swift; sourceTree = "<group>"; };
4F435C8F2BE117840087CEE3 /* SettingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingView.swift; sourceTree = "<group>"; };
4F5072B42BCF901E0005D352 /* discord-bot-helper.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "discord-bot-helper.app"; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -155,6 +157,7 @@
4FF2FEA32BDFAEC300973FDA /* Extension */ = {
isa = PBXGroup;
children = (
4F3A7B542BE836BF0046765E /* Extension+View.swift */,
4FF2FEA42BDFAF4F00973FDA /* Extension+TextFieldStyle.swift */,
);
path = Extension;
Expand Down Expand Up @@ -196,7 +199,7 @@
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1520;
LastUpgradeCheck = 1520;
LastUpgradeCheck = 1530;
TargetAttributes = {
4F5072B32BCF901E0005D352 = {
CreatedOnToolsVersion = 15.2;
Expand Down Expand Up @@ -275,6 +278,7 @@
4FD55D502BE701FE00581F34 /* PrivacyPolicyView.swift in Sources */,
4FD55D4B2BE6F92400581F34 /* AppInfo.swift in Sources */,
4F5C1BF52BDDDC2C001C9A51 /* SendMessageViewModel.swift in Sources */,
4F3A7B552BE836BF0046765E /* Extension+View.swift in Sources */,
4FF2FEA52BDFAF4F00973FDA /* Extension+TextFieldStyle.swift in Sources */,
4F435C902BE117840087CEE3 /* SettingView.swift in Sources */,
4F5072BA2BCF901E0005D352 /* SendMessageView.swift in Sources */,
Expand Down Expand Up @@ -322,6 +326,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand Down Expand Up @@ -383,6 +388,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand Down Expand Up @@ -410,6 +416,7 @@
CODE_SIGN_ENTITLEMENTS = "discord-bot-helper/discord_bot_helper.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"discord-bot-helper/Preview Content\"";
DEVELOPMENT_TEAM = XU74X3434S;
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -427,7 +434,7 @@
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault;
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
IPHONEOS_DEPLOYMENT_TARGET = 17.2;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 14.2;
Expand All @@ -451,6 +458,7 @@
CODE_SIGN_ENTITLEMENTS = "discord-bot-helper/discord_bot_helper.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"discord-bot-helper/Preview Content\"";
DEVELOPMENT_TEAM = XU74X3434S;
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -468,7 +476,7 @@
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault;
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
IPHONEOS_DEPLOYMENT_TARGET = 17.2;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 14.2;
Expand Down
23 changes: 23 additions & 0 deletions discord-bot-helper/Extension/Extension+View.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// Extension+View.swift
// discord-bot-helper
//
// Created by 村石 拓海 on 2024/05/06.
//

import SwiftUI

extension View {
@ViewBuilder func onChange<V: Equatable>(of value: V, initial: Bool, perform action: @escaping (_ newValue: V) -> Void) -> some View {
if #available(iOS 17.0, *) {
onChange(of: value, initial: initial) {
action($1)
}
} else if initial {
onAppear { action(value) }
.onChange(of: value, perform: action)
} else {
onChange(of: value, perform: action)
}
}
}
Comment on lines +10 to +23
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ViewのExtension
もしかしたらいらないかもしれない

以下で良さそう

.onChange(of: ) { _ in
   // hoge
}

11 changes: 7 additions & 4 deletions discord-bot-helper/SendMessageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ struct SendMessageView: View {
.ignoresSafeArea(edges: [.top])
VStack(spacing: .zero) {
VStack(spacing: 8.0) {
Spacer()

HStack {
withIconTextFieldView(
icon: Image(systemName: "link.icloud.fill"),
placeholder: "URLを入れてください",
text: $inputURL
)
.onChange(of: inputURL) {
.onChange(of: inputURL, initial: true) { _ in
textFieldValidation()
}

Expand Down Expand Up @@ -64,6 +66,7 @@ struct SendMessageView: View {
text: $inputContext
)
}
.padding(.horizontal)

Spacer()
.frame(height: 24.0)
Expand All @@ -73,15 +76,15 @@ struct SendMessageView: View {
placeholder: "埋め込みタイトルを入れてください",
text: $inputEmbedTitle
)
.padding(.horizontal)

Spacer()
.frame(height: 48.0)

sendButton(isTapEnabled: isTapEnable)

BannerView()
}
.padding()

BannerView()
}
}
}
Expand Down