Skip to content

Commit

Permalink
Merge pull request #39 from shilokuma-inc/feat/data_for_easy
Browse files Browse the repository at this point in the history
【FEAT】Easy用のデータを用意する
  • Loading branch information
mrs1669 authored May 15, 2024
2 parents 65f99b4 + 17aaf52 commit 43edf14
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 74 deletions.
24 changes: 20 additions & 4 deletions PrimePickApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,22 @@

/* Begin PBXBuildFile section */
4F0C82822BC8247500E1480E /* PrimePickApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F0C82812BC8247500E1480E /* PrimePickApp.swift */; };
4F0C82842BC8247500E1480E /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F0C82832BC8247500E1480E /* ContentView.swift */; };
4F0C82842BC8247500E1480E /* MainView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F0C82832BC8247500E1480E /* MainView.swift */; };
4F0C82862BC8247600E1480E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4F0C82852BC8247600E1480E /* Assets.xcassets */; };
4F0C828A2BC8247600E1480E /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4F0C82892BC8247600E1480E /* Preview Assets.xcassets */; };
4F8BE16C2BF4FFB000D7CF0E /* PrimeData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F8BE16B2BF4FFB000D7CF0E /* PrimeData.swift */; };
4F8BE16E2BF504BB00D7CF0E /* QuizView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F8BE16D2BF504BB00D7CF0E /* QuizView.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
4F0C827E2BC8247500E1480E /* PrimePickApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PrimePickApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
4F0C82812BC8247500E1480E /* PrimePickApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrimePickApp.swift; sourceTree = "<group>"; };
4F0C82832BC8247500E1480E /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
4F0C82832BC8247500E1480E /* MainView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainView.swift; sourceTree = "<group>"; };
4F0C82852BC8247600E1480E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
4F0C82872BC8247600E1480E /* PrimePickApp.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = PrimePickApp.entitlements; sourceTree = "<group>"; };
4F0C82892BC8247600E1480E /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
4F8BE16B2BF4FFB000D7CF0E /* PrimeData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrimeData.swift; sourceTree = "<group>"; };
4F8BE16D2BF504BB00D7CF0E /* QuizView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuizView.swift; sourceTree = "<group>"; };
4FC177B82BEEAB2C00447A06 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -55,7 +59,9 @@
children = (
4FC177B82BEEAB2C00447A06 /* Info.plist */,
4F0C82812BC8247500E1480E /* PrimePickApp.swift */,
4F0C82832BC8247500E1480E /* ContentView.swift */,
4F0C82832BC8247500E1480E /* MainView.swift */,
4F8BE16D2BF504BB00D7CF0E /* QuizView.swift */,
4F8BE1682BF4FB8E00D7CF0E /* QuizData */,
4F0C82852BC8247600E1480E /* Assets.xcassets */,
4F0C82872BC8247600E1480E /* PrimePickApp.entitlements */,
4F0C82882BC8247600E1480E /* Preview Content */,
Expand All @@ -71,6 +77,14 @@
path = "Preview Content";
sourceTree = "<group>";
};
4F8BE1682BF4FB8E00D7CF0E /* QuizData */ = {
isa = PBXGroup;
children = (
4F8BE16B2BF4FFB000D7CF0E /* PrimeData.swift */,
);
path = QuizData;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -141,8 +155,10 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
4F0C82842BC8247500E1480E /* ContentView.swift in Sources */,
4F0C82842BC8247500E1480E /* MainView.swift in Sources */,
4F8BE16E2BF504BB00D7CF0E /* QuizView.swift in Sources */,
4F0C82822BC8247500E1480E /* PrimePickApp.swift in Sources */,
4F8BE16C2BF4FFB000D7CF0E /* PrimeData.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
70 changes: 0 additions & 70 deletions PrimePickApp/ContentView.swift

This file was deleted.

70 changes: 70 additions & 0 deletions PrimePickApp/MainView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
//
// ContentView.swift
// PrimePickApp
//
// Created by 村石 拓海 on 2024/04/11.
//

import SwiftUI

struct MainView: View {
var body: some View {
NavigationStack {
VStack {
Text("PrimePick")
.font(.custom("Helvetica Neue", size: 40))
.fontWeight(.bold)
.padding(.top, 100)
.padding(.bottom, 30)

Spacer()

Text("Select Difficulty")
.font(.headline)
.padding()

Button(action: {
// Hardボタンのアクション
}) {
Text("Hard")
.padding()
.frame(maxWidth: .infinity)
.background(Color.red)
.foregroundColor(.white)
.cornerRadius(20)
}
.padding(.horizontal, 50)
.padding(.bottom, 10)

Button(action: {
// Normalボタンのアクション
}) {
Text("Normal")
.padding()
.frame(maxWidth: .infinity)
.background(Color.blue)
.foregroundColor(.white)
.cornerRadius(20)
}
.padding(.horizontal, 50)
.padding(.bottom, 10)

NavigationLink(destination: QuizView()) {
Text("Easy")
.padding()
.frame(maxWidth: .infinity)
.background(Color.green)
.foregroundColor(.white)
.cornerRadius(20)
}
.padding(.horizontal, 50)

Spacer()
}
}
}
}

#Preview {
MainView()
}
25 changes: 25 additions & 0 deletions PrimePickApp/QuizData/PrimeData.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// PrimeData.swift
// PrimePickApp
//
// Created by 村石 拓海 on 2024/05/15.
//

import Foundation

final class PrimeData {
init() {}

public func generateOneOrTwoDigitPrimes() -> [Int] {
var twoDigitPrimes = [Int]()
outerLoop: for num in 3..<100 {
for i in 2..<num {
if num % i == 0 {
continue outerLoop
}
}
twoDigitPrimes.append(num)
}
return twoDigitPrimes
}
}
27 changes: 27 additions & 0 deletions PrimePickApp/QuizView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// QuizView.swift
// PrimePickApp
//
// Created by 村石 拓海 on 2024/05/15.
//

import SwiftUI

struct QuizView: View {
let primeData = PrimeData()
var primes: [Int]
init() {
primes = primeData.generateOneOrTwoDigitPrimes()
}

var body: some View {
List(primes, id: \.self) { prime in
Text("\(prime)")
}
.navigationTitle("Primes")
}
}

#Preview {
QuizView()
}

0 comments on commit 43edf14

Please # to comment.