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

作品投稿画面のテンプレート2 #68

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft
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
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@
0CF733722A2DBB7200680560 /* CollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CF733712A2DBB7200680560 /* CollectionView.swift */; };
0CF733742A36FA2000680560 /* TagView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CF733732A36FA2000680560 /* TagView.swift */; };
0CFE7BC3286A2A6500CA5119 /* ButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CFE7BC2286A2A6500CA5119 /* ButtonView.swift */; };
AA157CF52AE6460100007BFA /* PostView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA157CF42AE6460100007BFA /* PostView.swift */; };
AA31E7F828EAD00B00DCE061 /* FloatingActionButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA31E7F728EAD00B00DCE061 /* FloatingActionButtonView.swift */; };
AA31E7FA28F542C700DCE061 /* TestView1.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA31E7F928F542C700DCE061 /* TestView1.swift */; };
AA31E7FC28F542D900DCE061 /* TestView2.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA31E7FB28F542D900DCE061 /* TestView2.swift */; };
@@ -48,6 +49,7 @@
0CF733712A2DBB7200680560 /* CollectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionView.swift; sourceTree = "<group>"; };
0CF733732A36FA2000680560 /* TagView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagView.swift; sourceTree = "<group>"; };
0CFE7BC2286A2A6500CA5119 /* ButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonView.swift; sourceTree = "<group>"; };
AA157CF42AE6460100007BFA /* PostView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostView.swift; sourceTree = "<group>"; };
AA31E7F728EAD00B00DCE061 /* FloatingActionButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FloatingActionButtonView.swift; sourceTree = "<group>"; };
AA31E7F928F542C700DCE061 /* TestView1.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestView1.swift; sourceTree = "<group>"; };
AA31E7FB28F542D900DCE061 /* TestView2.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestView2.swift; sourceTree = "<group>"; };
@@ -113,6 +115,7 @@
isa = PBXGroup;
children = (
AB633C89299F1A2100F57244 /* ImageSelectView.swift */,
AA157CF42AE6460100007BFA /* PostView.swift */,
);
path = Molecules;
sourceTree = "<group>";
@@ -374,6 +377,7 @@
0CFE7BC3286A2A6500CA5119 /* ButtonView.swift in Sources */,
ABC44B212918F62D00BBE1A6 /* LoginPage.swift in Sources */,
ABC44B252918F62D00BBE1A6 /* LoginService.swift in Sources */,
AA157CF52AE6460100007BFA /* PostView.swift in Sources */,
FC7EC30D28EAC89300600302 /* TextField.swift in Sources */,
AADD20EC292B6A45008EE02E /* PublishingSettingToggleButtonView.swift in Sources */,
ABC44B242918F62D00BBE1A6 /* APIServiceError.swift in Sources */,
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
//
// PostView.swift
// portfolio-ios-swiftui
//
// Created by Takeru Sakakibara on 2023/06/26.
//

import SwiftUI

struct PostView: View {
@State private var publishing = false

@State private var title: String = ""
@State private var description: String = ""
@State private var githubLink: String = ""
@State private var youtubeLink: String = ""

@FocusState var focus: Bool

var body: some View {
VStack(alignment: .leading) {
HStack {
Button(
action: {
// ここにアクションを追加する
},
label: {
SwiftUI.Image(systemName: "lessthan")
.resizable()
.frame(width: 15, height: 30)
.foregroundColor(.gray)
}
)
.padding(.leading)

IconView(
imageName: URL(
string: "https://pbs.twimg.com/media/Fx_ZC9saQAAI4Z5?format=jpg&name=large"),
iconPattern: .small
)
Spacer()
BaseButtonView(
action: { print("何か処理をするよー") },
labelText: "下書き",
foregroundColor: Color.textPinkColor,
backgroundColor: Color.clear, radius: 25, lineColor: Color.textPinkColor
)
BaseButtonView(
action: { print("何か処理をするよー") },
labelText: "投稿",
foregroundColor: Color.white,
backgroundColor: Color.subPink, radius: 25
)
.padding(.trailing)
}
Divider()
.frame(width: 360, height: 1)
.background(Color.black)
.padding(EdgeInsets(
top: 10,
leading: 15,
bottom: 10,
trailing: 0
))

ScrollView {
HStack {
Text("公開設定")
.padding(.leading, 28)
.foregroundColor(Color.text)
Spacer()
}
HStack {
Toggle("公開", isOn: $publishing)
.toggleStyle(SwitchToggleStyle(tint: .textPinkColor))
.frame(width: 100, alignment: .leading)
.padding(.leading, 35)
Spacer()
// 上記は、.leadingの指定を受け付けてくれないのでこのような実装に
}
TextBox(inputText: $title, titleText: "タイトル", width: 300, isRequired: true)
.padding(20)
TextBox(inputText: $description, titleText: "説明文", lines: 6...6)
.padding(20)
TextBox(inputText: $githubLink, titleText: "Githubリンク", width: 300)
.padding(20)
TextBox(inputText: $youtubeLink, titleText: "Youtubeリンク", width: 300)
.padding(20)
// tagのviewはここに
let item = ["おはよう", "こんにちは", "さようなら"]

HStack {
Text("タグの追加")
.padding(.leading, 28)
.foregroundColor(Color.text)
Spacer()
}
TagView(item: item, viewPattern: .detail)
// 写真追加も

}
.focused(self.$focus)
.toolbar {
ToolbarItem(placement: .keyboard) {
HStack {
Spacer()
Button("完了") {
self.focus = false
}
}
}
}
}
}
}

struct PostView_Previews: PreviewProvider {
static var previews: some View {
PostView()
}
}