Skip to content

Commit

Permalink
Merge pull request #22 from APPSCHOOL3-iOS/feature/#2---RecruitFeedView
Browse files Browse the repository at this point in the history
Feature/#2   recruit feed view
  • Loading branch information
Haesus authored Aug 22, 2023
2 parents 8cfdeb1 + 15f8bb2 commit ce929bc
Show file tree
Hide file tree
Showing 6 changed files with 336 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@
9E99CCF02A944A5700699B6A /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E99CCEF2A944A5700699B6A /* ContentView.swift */; };
9E99CCF22A944A5A00699B6A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9E99CCF12A944A5A00699B6A /* Assets.xcassets */; };
9E99CCF52A944A5A00699B6A /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9E99CCF42A944A5A00699B6A /* Preview Assets.xcassets */; };
B76000792A946E4E00F35291 /* RecruitFeedViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B76000782A946E4E00F35291 /* RecruitFeedViewModel.swift */; };
B760007B2A946E5900F35291 /* RecruitFeedView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B760007A2A946E5900F35291 /* RecruitFeedView.swift */; };
B7610B832A94E3AA0074F78C /* RecruitFeedMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7610B822A94E3AA0074F78C /* RecruitFeedMap.swift */; };
F485B74A2A94570F00A2F5FF /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = F485B7492A94570F00A2F5FF /* GoogleService-Info.plist */; };
F485B74D2A94574200A2F5FF /* FirebaseAuth in Frameworks */ = {isa = PBXBuildFile; productRef = F485B74C2A94574200A2F5FF /* FirebaseAuth */; };
F485B74F2A94574200A2F5FF /* FirebaseFirestore in Frameworks */ = {isa = PBXBuildFile; productRef = F485B74E2A94574200A2F5FF /* FirebaseFirestore */; };
F485B7512A94574200A2F5FF /* FirebaseFirestoreCombine-Community in Frameworks */ = {isa = PBXBuildFile; productRef = F485B7502A94574200A2F5FF /* FirebaseFirestoreCombine-Community */; };
F485B7532A94574200A2F5FF /* FirebaseFirestoreSwift in Frameworks */ = {isa = PBXBuildFile; productRef = F485B7522A94574200A2F5FF /* FirebaseFirestoreSwift */; };
F485B7552A94584400A2F5FF /* AuthViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F485B7542A94584400A2F5FF /* AuthViewModel.swift */; };
FAA6FC222A949FF2005E31DC /* Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAA6FC212A949FF2005E31DC /* Extension.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -25,8 +29,12 @@
9E99CCEF2A944A5700699B6A /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
9E99CCF12A944A5A00699B6A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
9E99CCF42A944A5A00699B6A /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
B76000782A946E4E00F35291 /* RecruitFeedViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecruitFeedViewModel.swift; sourceTree = "<group>"; };
B760007A2A946E5900F35291 /* RecruitFeedView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecruitFeedView.swift; sourceTree = "<group>"; };
B7610B822A94E3AA0074F78C /* RecruitFeedMap.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecruitFeedMap.swift; sourceTree = "<group>"; };
F485B7492A94570F00A2F5FF /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
F485B7542A94584400A2F5FF /* AuthViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthViewModel.swift; sourceTree = "<group>"; };
FAA6FC212A949FF2005E31DC /* Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extension.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -63,9 +71,10 @@
9E99CCEC2A944A5700699B6A /* project02-teamB-OUR-consumer */ = {
isa = PBXGroup;
children = (
FA2585D82A947E3200CFA8CE /* GoogleService-Info.plist */,
9E99CCED2A944A5700699B6A /* project02_teamB_OUR_consumerApp.swift */,
9E99CCEF2A944A5700699B6A /* ContentView.swift */,
B76000762A946E1F00F35291 /* RecruitFeedView */,
FAA6FC212A949FF2005E31DC /* Extension.swift */,
F485B7562A94584800A2F5FF /* ViewModel */,
9E99CCF12A944A5A00699B6A /* Assets.xcassets */,
F485B7492A94570F00A2F5FF /* GoogleService-Info.plist */,
Expand All @@ -82,6 +91,14 @@
path = "Preview Content";
sourceTree = "<group>";
};
B76000762A946E1F00F35291 /* RecruitFeedView */ = {
isa = PBXGroup;
children = (
B76000782A946E4E00F35291 /* RecruitFeedViewModel.swift */,
B760007A2A946E5900F35291 /* RecruitFeedView.swift */,
B7610B822A94E3AA0074F78C /* RecruitFeedMap.swift */,
);
path = RecruitFeedView;
F485B7562A94584800A2F5FF /* ViewModel */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -171,8 +188,12 @@
buildActionMask = 2147483647;
files = (
9E99CCF02A944A5700699B6A /* ContentView.swift in Sources */,
B760007B2A946E5900F35291 /* RecruitFeedView.swift in Sources */,
B7610B832A94E3AA0074F78C /* RecruitFeedMap.swift in Sources */,
B76000792A946E4E00F35291 /* RecruitFeedViewModel.swift in Sources */,
9E99CCEE2A944A5700699B6A /* project02_teamB_OUR_consumerApp.swift in Sources */,
F485B7552A94584400A2F5FF /* AuthViewModel.swift in Sources */,
FAA6FC222A949FF2005E31DC /* Extension.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -309,6 +330,7 @@
DEVELOPMENT_TEAM = "";
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "Please allow us to access your location";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
Expand Down Expand Up @@ -339,6 +361,7 @@
DEVELOPMENT_TEAM = "";
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "Please allow us to access your location";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,51 +6,72 @@
//

import SwiftUI
import MapKit
import CoreLocationUI

struct ContentView: View {

enum TabItem {
case feed, studyFeed, recruitAdd, alarm, myPage
}

@State private var selectedTab: TabItem = .feed
@State private var mainLogoToggle: Bool = true

let hexColor: String = "#090580" //메인컬러로 변경

var body: some View {
NavigationStack {
TabView {
//FeedView 팀에서 넣어주시면 됩니다.
TabView(selection: $selectedTab) {
//FeedView
Image(systemName: "house.fill")
.tag(TabItem.feed)
.tabItem {
Image(systemName: "house.fill")
Label("피드", systemImage: "house.fill")
}
//StudyFeedView 팀에서 넣어주시면 됩니다.
//StudyFeedView
Image(systemName: "book.fill")
.tag(TabItem.studyFeed)
.tabItem {
Image(systemName: "book.fill")
Label("스터디모집", systemImage: "book.fill")
}
//RecruitAddView 팀에서 넣어주시면 됩니다.
Image(systemName: "plus.app.fill")
RecruitFeedView()
.tag(TabItem.recruitAdd)
.tabItem {
Image(systemName: "plus.app.fill")
Label("작성하기", systemImage: "plus.app.fill")
}
//AlarmView 팀에서 넣어주시면 됩니다.
//AlarmView
Image(systemName: "bell.fill")
.tag(TabItem.alarm)
.tabItem {
Image(systemName: "bell.fill")
Label("알림", systemImage: "bell.fill")
}
//MyPageView 팀에서 넣어주시면 됩니다.
//MyPageView
Image(systemName: "person.fill")
.tag(TabItem.myPage)
.tabItem {
Image(systemName: "person.fill")
Label("마이페이지", systemImage: "person.fill")
}
}
.navigationBarItems(leading: Button(action: {
//FeedView로 돌아가기
}, label: {
Image("OUR_Logo")
.resizable()
.aspectRatio(contentMode: .fit)
}))
.tint(Color(hex: hexColor)) // 메인컬러로 변경
.navigationBarItems(leading: leadingBarItem)
}
}
}

@ViewBuilder
var leadingBarItem: some View {
if mainLogoToggle && selectedTab != .alarm && selectedTab != .myPage {
Image("OUR_Logo")
.resizable()
.aspectRatio(contentMode: .fit)
}
}
}

struct ContentView_Preview: PreviewProvider {
static var previews: some View {
ContentView()
}
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// Extension.swift
// project02-teamB-OUR-consumer
//
// Created by 윤해수 on 2023/08/22.
//

import SwiftUI

//Color extension확장하여 Hex Color 받아서 바꾸기
extension Color {
init(hex: String) {
var hexSanitized = hex.trimmingCharacters(in: .whitespacesAndNewlines)
hexSanitized = hexSanitized.replacingOccurrences(of: "#", with: "")

var rgb: UInt64 = 0

Scanner(string: hexSanitized).scanHexInt64(&rgb)

self.init(
red: Double((rgb & 0xFF0000) >> 16) / 255.0,
green: Double((rgb & 0x00FF00) >> 8) / 255.0,
blue: Double(rgb & 0x0000FF) / 255.0
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
//
// RecruitFeedMap.swift
// project02-teamB-OUR-consumer
//
// Created by kaikim on 2023/08/22.
//

import SwiftUI
import CoreLocation
import CoreLocationUI

class LocationManager: NSObject, ObservableObject {

private let manager = CLLocationManager()
@Published var userLocation: CLLocation?
static let shared = LocationManager()
var addressString = ""

override init() {
super.init()
manager.delegate = self
manager.desiredAccuracy = kCLLocationAccuracyBest
manager.startUpdatingLocation()
}

func requestLocation() {
manager.requestWhenInUseAuthorization()
}

}

extension LocationManager: CLLocationManagerDelegate {
func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {

switch status {

case .notDetermined:
print("DEBUG: Not Determined")
case .restricted:
print("DEBUG: Restricted")
case .denied:
print("DEBUG: Denied")
case .authorizedAlways:
print("DEBUG: Auth always")
case .authorizedWhenInUse:
print("DEBUG: AUTH when in use")
@unknown default:
break
}
}

func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
guard let location = locations.last else { return}
self.userLocation = location

}


}
Loading

0 comments on commit ce929bc

Please sign in to comment.