mirror of
https://github.com/neon443/RNG_Swift.git
synced 2026-03-11 06:49:12 +00:00
Building w/ Xcodeproj
This commit is contained in:
@@ -1,47 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CachedManifest</key>
|
||||
<dict>
|
||||
<key>manifestData</key>
|
||||
<data>
|
||||
eyJkZXBlbmRlbmNpZXMiOltdLCJkaXNwbGF5TmFtZSI6IlJORyIsInBhY2th
|
||||
Z2VLaW5kIjp7InJvb3QiOnt9fSwicGxhdGZvcm1zIjpbeyJvcHRpb25zIjpb
|
||||
XSwicGxhdGZvcm1OYW1lIjoiaW9zIiwidmVyc2lvbiI6IjE2LjAifV0sInBy
|
||||
b2R1Y3RzIjpbeyJuYW1lIjoiUk5HIiwic2V0dGluZ3MiOlt7ImRpc3BsYXlW
|
||||
ZXJzaW9uIjpbIjEuMCJdfSx7ImJ1bmRsZVZlcnNpb24iOlsiMSJdfSx7ImlP
|
||||
U0FwcEluZm8iOlt7ImFjY2VudENvbG9yIjp7InByZXNldENvbG9yIjp7InBy
|
||||
ZXNldENvbG9yIjp7InJhd1ZhbHVlIjoiYmx1ZSJ9fX0sImFwcENhdGVnb3J5
|
||||
Ijp7InJhd1ZhbHVlIjoicHVibGljLmFwcC1jYXRlZ29yeS51dGlsaXRpZXMi
|
||||
fSwiYXBwSWNvbiI6eyJwbGFjZWhvbGRlciI6eyJpY29uIjp7InJhd1ZhbHVl
|
||||
IjoiY2FsY3VsYXRvciJ9fX0sImNhcGFiaWxpdGllcyI6W10sInN1cHBvcnRl
|
||||
ZERldmljZUZhbWlsaWVzIjpbInBhZCIsInBob25lIl0sInN1cHBvcnRlZElu
|
||||
dGVyZmFjZU9yaWVudGF0aW9ucyI6W3sicG9ydHJhaXQiOnt9fSx7ImxhbmRz
|
||||
Y2FwZVJpZ2h0Ijp7fX0seyJsYW5kc2NhcGVMZWZ0Ijp7fX0seyJwb3J0cmFp
|
||||
dFVwc2lkZURvd24iOnsiY29uZGl0aW9uIjp7ImRldmljZUZhbWlsaWVzIjpb
|
||||
InBhZCJdfX19XX1dfV0sInRhcmdldHMiOlsiQXBwTW9kdWxlIl0sInR5cGUi
|
||||
OnsiZXhlY3V0YWJsZSI6bnVsbH19XSwidGFyZ2V0TWFwIjp7IkFwcE1vZHVs
|
||||
ZSI6eyJkZXBlbmRlbmNpZXMiOltdLCJleGNsdWRlIjpbXSwibmFtZSI6IkFw
|
||||
cE1vZHVsZSIsInBhY2thZ2VBY2Nlc3MiOnRydWUsInBhdGgiOiIuIiwicmVz
|
||||
b3VyY2VzIjpbXSwic2V0dGluZ3MiOlt7ImtpbmQiOnsiZW5hYmxlVXBjb21p
|
||||
bmdGZWF0dXJlIjp7Il8wIjoiQmFyZVNsYXNoUmVnZXhMaXRlcmFscyJ9fSwi
|
||||
dG9vbCI6InN3aWZ0In1dLCJ0eXBlIjoiZXhlY3V0YWJsZSJ9fSwidGFyZ2V0
|
||||
cyI6W3siZGVwZW5kZW5jaWVzIjpbXSwiZXhjbHVkZSI6W10sIm5hbWUiOiJB
|
||||
cHBNb2R1bGUiLCJwYWNrYWdlQWNjZXNzIjp0cnVlLCJwYXRoIjoiLiIsInJl
|
||||
c291cmNlcyI6W10sInNldHRpbmdzIjpbeyJraW5kIjp7ImVuYWJsZVVwY29t
|
||||
aW5nRmVhdHVyZSI6eyJfMCI6IkJhcmVTbGFzaFJlZ2V4TGl0ZXJhbHMifX0s
|
||||
InRvb2wiOiJzd2lmdCJ9XSwidHlwZSI6ImV4ZWN1dGFibGUifV0sInRvb2xz
|
||||
VmVyc2lvbiI6eyJfdmVyc2lvbiI6IjUuOS4wIn19
|
||||
</data>
|
||||
<key>manifestHash</key>
|
||||
<data>
|
||||
ZB/SWxlchPYcczKX1JhFcosGzSflW/fzQhD7DXE27Pk=
|
||||
</data>
|
||||
<key>schemaVersion</key>
|
||||
<integer>4</integer>
|
||||
<key>swiftPMVersionString</key>
|
||||
<string>5.10.0-dev</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>DocumentThumbnailConfiguration</key>
|
||||
<dict>
|
||||
<key>accentColorHash</key>
|
||||
<data>
|
||||
Fkd2iMDgBpnGz6RJejYS1+g8UyBitkslD+2JCBKO1Ug=
|
||||
</data>
|
||||
<key>appIconHash</key>
|
||||
<data>
|
||||
0tSlknALCSBljl1W7VDr+qgrH0o+EF6bz9i8uwgcLoc=
|
||||
</data>
|
||||
<key>thumbnailIsPrerendered</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 72 KiB |
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Bucket
|
||||
uuid = "7D3468E0-8930-45B0-9787-2F5420A82D30"
|
||||
type = "1"
|
||||
version = "2.0">
|
||||
</Bucket>
|
||||
@@ -1,49 +0,0 @@
|
||||
import SwiftUI
|
||||
|
||||
struct ContentView: View {
|
||||
var body: some View {
|
||||
VStack {
|
||||
NavigationSplitView {
|
||||
List {
|
||||
NavigationLink {
|
||||
DiceView()
|
||||
.navigationTitle("Dice")
|
||||
} label: {
|
||||
HStack {
|
||||
Text("Dice")
|
||||
Spacer()
|
||||
Image(systemName: "die.face.1")
|
||||
Image(systemName: "die.face.2.fill")
|
||||
Image(systemName: "die.face.3")
|
||||
Image(systemName: "die.face.4.fill")
|
||||
Image(systemName: "die.face.5")
|
||||
Image(systemName: "die.face.6.fill")
|
||||
}
|
||||
}
|
||||
NavigationLink {
|
||||
PasswordView()
|
||||
} label: {
|
||||
HStack {
|
||||
Text("Password")
|
||||
Spacer()
|
||||
Image(systemName: "ellipsis.rectangle")
|
||||
}
|
||||
}
|
||||
NavigationLink {
|
||||
PasswordView()
|
||||
} label: {
|
||||
HStack {
|
||||
Text("Password")
|
||||
Spacer()
|
||||
Image(systemName: "rectangle.and.pencil.and.ellipsis")
|
||||
}
|
||||
}
|
||||
}
|
||||
.navigationTitle("RNG")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
} detail: {
|
||||
Image(systemName: "dice.fill")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
103
DiceView.swift
103
DiceView.swift
@@ -1,103 +0,0 @@
|
||||
import SwiftUI
|
||||
|
||||
struct DiceView: View {
|
||||
@State var generated: [Int] = [0]
|
||||
@State var displayDies: [Int] = []
|
||||
@State var displayMultiDieMode = ""
|
||||
@State var multiDieMode = "plus"
|
||||
@State var result = 0
|
||||
@State var resultDescription = ""
|
||||
@State var history: [Int] = []
|
||||
let columns = [GridItem(.adaptive(minimum: 25, maximum: 75))]
|
||||
@State var dies: Double = 1
|
||||
var body: some View {
|
||||
VStack {
|
||||
List {
|
||||
Section("Number of die") {
|
||||
HStack {
|
||||
Text(String(Int(dies)))
|
||||
Slider(value: $dies, in: 1...10, step: 1)
|
||||
}
|
||||
}
|
||||
Section("Multi die mode") {
|
||||
Picker(selection: $multiDieMode, label: Text("ioug")) {
|
||||
Image(systemName: "plus").tag("plus")
|
||||
Image(systemName: "multiply").tag("multiply")
|
||||
}.pickerStyle(SegmentedPickerStyle())
|
||||
}
|
||||
Section("Visual") {
|
||||
HStack {
|
||||
Spacer()
|
||||
if displayDies.isEmpty {
|
||||
Text("Results are visualised here when you press the generate button")
|
||||
.font(.subheadline)
|
||||
} else if displayDies.count != Int(dies) {
|
||||
Text("Press Generate")
|
||||
.font(.title)
|
||||
} else {
|
||||
LazyVGrid(columns: columns, spacing: 10) {
|
||||
ForEach(0..<displayDies.count, id: \.self) { index in
|
||||
Image(systemName: "die.face.\(index > displayDies.count ? Int.random(in: 1...6) : displayDies[index])")
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.frame(width: 50, height: 50)
|
||||
if index != displayDies.count-1 {
|
||||
Image(systemName: displayMultiDieMode)
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.frame(width: 10, height: 10)
|
||||
}
|
||||
}
|
||||
}.padding()
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
Button("Generate") {
|
||||
generated = rngN6DieArr(dies: Int(dies))
|
||||
displayDies = generated
|
||||
displayMultiDieMode = multiDieMode
|
||||
result = arrCombine(arr: generated, combineMode: multiDieMode)
|
||||
resultDescription = describeResult(inp: displayDies, combineMode: multiDieMode)
|
||||
}
|
||||
HStack {
|
||||
Spacer()
|
||||
Text(String(result))
|
||||
.bold()
|
||||
.font(.largeTitle)
|
||||
Spacer()
|
||||
}
|
||||
Text(resultDescription)
|
||||
}
|
||||
.listRowSpacing(5)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func describeResult(inp: [Int], combineMode: String) -> String {
|
||||
let len = inp.count-1
|
||||
var result = ""
|
||||
var symbol = ""
|
||||
if inp.isEmpty {
|
||||
return "0"
|
||||
} else {
|
||||
if combineMode == "plus" {
|
||||
symbol = " + "
|
||||
} else if combineMode == "multiply" {
|
||||
symbol = " x "
|
||||
}
|
||||
for i in 0...len {
|
||||
if i == len {
|
||||
result += String(inp[i])
|
||||
} else {
|
||||
result += String(inp[i]) + symbol
|
||||
}
|
||||
}
|
||||
result += " = " + String(arrCombine(arr: inp, combineMode: combineMode))
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
DiceView()
|
||||
}
|
||||
94
MyApp.swift
94
MyApp.swift
@@ -1,94 +0,0 @@
|
||||
import SwiftUI
|
||||
|
||||
@main
|
||||
struct RNGApp: App {
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
ContentView()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// array combiner, adds up all ints in an array
|
||||
func totalIntArr(arr: [Int]) -> Int {
|
||||
var total = 0
|
||||
for num in arr {
|
||||
total += num
|
||||
}
|
||||
return total
|
||||
}
|
||||
|
||||
// array combiner, adds up all doubles in an array
|
||||
func totalDoubleArr(arr: [Double]) -> Double {
|
||||
var total: Double = 0
|
||||
for num in arr {
|
||||
total += num
|
||||
}
|
||||
return total
|
||||
}
|
||||
|
||||
// array combiner, adds or multiplies all ints in an array
|
||||
func arrCombine(arr: [Int], combineMode: String) -> Int {
|
||||
var output = 0
|
||||
if combineMode == "plus" {
|
||||
for num in arr {
|
||||
output += num
|
||||
}
|
||||
} else if combineMode == "multiply" {
|
||||
output = 1
|
||||
for num in arr {
|
||||
output *= num
|
||||
}
|
||||
} else {
|
||||
print("invalid combineMode '\(combineMode)'. must be 'plus' or 'multiply', returning 0")
|
||||
return 0
|
||||
}
|
||||
return output
|
||||
}
|
||||
|
||||
|
||||
func rng(min: Int, max: Int, step: Int) -> Int {
|
||||
let range = (max - min) / step + 1
|
||||
var rng = Int.random(in: 0..<range)
|
||||
rng = min + rng * step
|
||||
return rng
|
||||
}
|
||||
|
||||
func rng6Die() -> Int {
|
||||
return Int.random(in: 1...6)
|
||||
}
|
||||
|
||||
func rngCDie(min: Int, max: Int) -> Int {
|
||||
return Int.random(in: min...max)
|
||||
}
|
||||
|
||||
func rngN6DieArr(dies: Int) -> [Int] {
|
||||
var output: [Int] = []
|
||||
for _ in 1...dies {
|
||||
output.append(rng6Die())
|
||||
}
|
||||
return output
|
||||
}
|
||||
|
||||
func rngNCDie(dies: Int, min: Int, max: Int) -> [Int] {
|
||||
var output: [Int] = []
|
||||
for _ in 1...dies {
|
||||
output.append(rngCDie(min: min, max: max))
|
||||
}
|
||||
return output
|
||||
}
|
||||
|
||||
func rngInt(len: Int) -> Int {
|
||||
var result = ""
|
||||
for _ in 1...len {
|
||||
result += String(Int.random(in: 0...9))
|
||||
}
|
||||
let resultInt = Int(result)
|
||||
return resultInt!
|
||||
}
|
||||
|
||||
func rngString(len: Int) -> String {
|
||||
let letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
||||
return String((1..<len).map{ _ in letters.randomElement()! })
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
// swift-tools-version: 5.9
|
||||
|
||||
// WARNING:
|
||||
// This file is automatically generated.
|
||||
// Do not edit it by hand because the contents will be replaced.
|
||||
|
||||
import PackageDescription
|
||||
import AppleProductTypes
|
||||
|
||||
let package = Package(
|
||||
name: "RNG",
|
||||
platforms: [
|
||||
.iOS("16.0")
|
||||
],
|
||||
products: [
|
||||
.iOSApplication(
|
||||
name: "RNG",
|
||||
targets: ["AppModule"],
|
||||
bundleIdentifier: "com.neon443.RNG",
|
||||
teamIdentifier: "8626DL2GW3",
|
||||
displayVersion: "1.0",
|
||||
bundleVersion: "1",
|
||||
appIcon: .placeholder(icon: .calculator),
|
||||
accentColor: .presetColor(.blue),
|
||||
supportedDeviceFamilies: [
|
||||
.pad,
|
||||
.phone
|
||||
],
|
||||
supportedInterfaceOrientations: [
|
||||
.portrait,
|
||||
.landscapeRight,
|
||||
.landscapeLeft,
|
||||
.portraitUpsideDown(.when(deviceFamilies: [.pad]))
|
||||
],
|
||||
appCategory: .utilities
|
||||
)
|
||||
],
|
||||
targets: [
|
||||
.executableTarget(
|
||||
name: "AppModule",
|
||||
path: ".",
|
||||
swiftSettings: [
|
||||
.enableUpcomingFeature("BareSlashRegexLiterals")
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@@ -1,190 +0,0 @@
|
||||
//
|
||||
// PasswordView.swift
|
||||
// RNG
|
||||
//
|
||||
// Created by Nihaal on 30/05/2024.
|
||||
//
|
||||
|
||||
//////////////////////////// IMPLEMENT A WORKING BUTTON
|
||||
//////////////////////////// current one does nothing lol
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct PasswordView: View {
|
||||
@State var viewType = "simple"
|
||||
@State var passType = "code"
|
||||
@State var codeLen = 4
|
||||
@State var customLen: Double = 0
|
||||
@State var customLenStr = ""
|
||||
@State var generated = ""
|
||||
@State var result = ""
|
||||
@State var history: [Int] = []
|
||||
@State var showPassCodeWordHelpSheet = false
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
List {
|
||||
Section("View mode") {
|
||||
Picker("simple", selection: $viewType) {
|
||||
Text("Simple").tag("simple")
|
||||
Text("Advanced").tag("advanced")
|
||||
}
|
||||
.pickerStyle(.segmented)
|
||||
}
|
||||
Section("Generate a...") {
|
||||
HStack {
|
||||
Picker("code", selection: $passType) {
|
||||
Text("Passcode").tag("code")
|
||||
Text("Password").tag("word")
|
||||
}
|
||||
.pickerStyle(.segmented)
|
||||
}
|
||||
HStack {
|
||||
Spacer()
|
||||
Text("Only numbers 0-9")
|
||||
Spacer()
|
||||
Divider()
|
||||
Spacer()
|
||||
Text("Letters a-z, A-Z and numbers 0-9")
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
Section("Length") {
|
||||
Picker("", selection: $codeLen) {
|
||||
Text("4").tag(4)
|
||||
Text("6").tag(6)
|
||||
Text(customLen == 0 ? "Custom" : String(Int(customLen))).tag(-1)
|
||||
}
|
||||
.pickerStyle(.segmented)
|
||||
if codeLen == -1 {
|
||||
HStack {
|
||||
Slider(value: $customLen, in: 1...20, step: 1)
|
||||
TextField("Enter a num", text: $customLenStr)
|
||||
.keyboardType(.numberPad)
|
||||
.onChange(of: customLen) { newValue in
|
||||
customLenStr = String(Int(customLen))
|
||||
}
|
||||
.onChange(of: customLenStr) { newValue in
|
||||
customLen = Double(newValue)!
|
||||
}
|
||||
.textFieldStyle(RoundedBorderTextFieldStyle())
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
Section("Result") {
|
||||
HStack {
|
||||
Group {
|
||||
Spacer()
|
||||
Text(String(result))
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
HStack {
|
||||
Spacer()
|
||||
Text(String(generated))
|
||||
.font(.largeTitle)
|
||||
.bold()
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
Button("Generate") {
|
||||
if viewType == "simple" {
|
||||
if passType == "code" {
|
||||
if codeLen == 4 {
|
||||
generated = genPass(type: "4Int", min: nil, max: nil)
|
||||
} else if codeLen == 6 {
|
||||
generated = genPass(type: "6Int", min: nil, max: nil)
|
||||
}
|
||||
} else if passType == "word" {
|
||||
if codeLen == 4 {
|
||||
generated = genPass(type: "4String", min: nil, max: nil)
|
||||
} else if codeLen == 6 {
|
||||
generated = genPass(type: "6String", min: nil, max: nil)
|
||||
}
|
||||
}
|
||||
} else if viewType == "word" {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct PassCodeWordHelpView: View {
|
||||
@Environment(\.presentationMode) var presentationMode
|
||||
@Environment(\.dismiss) var dismiss
|
||||
var body: some View {
|
||||
VStack {
|
||||
Text(" ")
|
||||
HStack {
|
||||
Spacer()
|
||||
Text("Passcode")
|
||||
.font(.headline)
|
||||
Spacer()
|
||||
Text("Password")
|
||||
.font(.headline)
|
||||
Spacer()
|
||||
}
|
||||
HStack {
|
||||
List {
|
||||
Text("iopgt")
|
||||
Text("eiou")
|
||||
}
|
||||
.listStyle(GroupedListStyle())
|
||||
.padding(-10)
|
||||
List {
|
||||
Text("wi")
|
||||
}
|
||||
.listStyle(GroupedListStyle())
|
||||
.padding(-10)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func genPass(type: String, min: Int?, max: Int?) -> String {
|
||||
var result = ""
|
||||
if type == "4Int" {
|
||||
result = String(rngInt(len: 4))
|
||||
} else if type == "6Int" {
|
||||
result = String(rngInt(len: 6))
|
||||
} else if type == "4String" {
|
||||
result = rngString(len: 4)
|
||||
} else if type == "6String" {
|
||||
result = rngString(len: 6)
|
||||
} else if min != nil && max != nil {
|
||||
if type == "Int" {
|
||||
result = String(rngInt(len: max! - min!) + min!)
|
||||
} else if type == "String" {
|
||||
if min == nil {
|
||||
//if there no min, use max as length
|
||||
result = rngString(len: max!)
|
||||
} else {
|
||||
print("when type is String, leave min empty and use max as a length.")
|
||||
print("returning -1")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
print("invalid input")
|
||||
print("type = Int: give min and max")
|
||||
print("type = String: min = nil, max = length")
|
||||
print("Preset: (type = 4Int/String, 6Int/String) and leave min, max = nil")
|
||||
print(" 4Int: 0000-9999; 4 digit")
|
||||
print(" 6Int: 000000-999999; 6 digit")
|
||||
print(" 4String: a-z/0-9: _ _ _ _; 4 digit alphanumeric")
|
||||
print(" 6String: a-z/0-9: _ _ _ _ _ _; 6 digit alphanumeric")
|
||||
print("returning -1")
|
||||
result = "-1"
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
#Preview("PasswordView") {
|
||||
PasswordView()
|
||||
}
|
||||
#Preview("PassCodeWordHelpView") {
|
||||
PassCodeWordHelpView()
|
||||
}
|
||||
376
RNG.xcodeproj/project.pbxproj
Normal file
376
RNG.xcodeproj/project.pbxproj
Normal file
@@ -0,0 +1,376 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 56;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
A9794C832CB70ADA00527984 /* RNGApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9794C822CB70ADA00527984 /* RNGApp.swift */; };
|
||||
A9794C852CB70ADA00527984 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9794C842CB70ADA00527984 /* ContentView.swift */; };
|
||||
A9794C872CB70AE100527984 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A9794C862CB70AE100527984 /* Assets.xcassets */; };
|
||||
A9794C8B2CB70AE100527984 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A9794C8A2CB70AE100527984 /* Preview Assets.xcassets */; };
|
||||
A9794C922CB70BF600527984 /* DiceView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9794C912CB70BF600527984 /* DiceView.swift */; };
|
||||
A9794C942CB70C1400527984 /* NumberView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9794C932CB70C1400527984 /* NumberView.swift */; };
|
||||
A9794C962CB70C8000527984 /* PasswordView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9794C952CB70C8000527984 /* PasswordView.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
A9794C7F2CB70ADA00527984 /* RNG.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RNG.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
A9794C822CB70ADA00527984 /* RNGApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RNGApp.swift; sourceTree = "<group>"; };
|
||||
A9794C842CB70ADA00527984 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
|
||||
A9794C862CB70AE100527984 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
A9794C882CB70AE100527984 /* RNG.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = RNG.entitlements; sourceTree = "<group>"; };
|
||||
A9794C8A2CB70AE100527984 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
|
||||
A9794C912CB70BF600527984 /* DiceView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiceView.swift; sourceTree = "<group>"; };
|
||||
A9794C932CB70C1400527984 /* NumberView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NumberView.swift; sourceTree = "<group>"; };
|
||||
A9794C952CB70C8000527984 /* PasswordView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasswordView.swift; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
A9794C7C2CB70ADA00527984 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
A9794C762CB70ADA00527984 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A9794C812CB70ADA00527984 /* RNG */,
|
||||
A9794C802CB70ADA00527984 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
A9794C802CB70ADA00527984 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A9794C7F2CB70ADA00527984 /* RNG.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
A9794C812CB70ADA00527984 /* RNG */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A9794C822CB70ADA00527984 /* RNGApp.swift */,
|
||||
A9794C842CB70ADA00527984 /* ContentView.swift */,
|
||||
A9794C952CB70C8000527984 /* PasswordView.swift */,
|
||||
A9794C912CB70BF600527984 /* DiceView.swift */,
|
||||
A9794C932CB70C1400527984 /* NumberView.swift */,
|
||||
A9794C862CB70AE100527984 /* Assets.xcassets */,
|
||||
A9794C882CB70AE100527984 /* RNG.entitlements */,
|
||||
A9794C892CB70AE100527984 /* Preview Content */,
|
||||
);
|
||||
path = RNG;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
A9794C892CB70AE100527984 /* Preview Content */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A9794C8A2CB70AE100527984 /* Preview Assets.xcassets */,
|
||||
);
|
||||
path = "Preview Content";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
A9794C7E2CB70ADA00527984 /* RNG */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = A9794C8E2CB70AE100527984 /* Build configuration list for PBXNativeTarget "RNG" */;
|
||||
buildPhases = (
|
||||
A9794C7B2CB70ADA00527984 /* Sources */,
|
||||
A9794C7C2CB70ADA00527984 /* Frameworks */,
|
||||
A9794C7D2CB70ADA00527984 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = RNG;
|
||||
productName = RNG;
|
||||
productReference = A9794C7F2CB70ADA00527984 /* RNG.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
A9794C772CB70ADA00527984 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
BuildIndependentTargetsInParallel = 1;
|
||||
LastSwiftUpdateCheck = 1540;
|
||||
LastUpgradeCheck = 1540;
|
||||
TargetAttributes = {
|
||||
A9794C7E2CB70ADA00527984 = {
|
||||
CreatedOnToolsVersion = 15.4;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = A9794C7A2CB70ADA00527984 /* Build configuration list for PBXProject "RNG" */;
|
||||
compatibilityVersion = "Xcode 14.0";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = A9794C762CB70ADA00527984;
|
||||
productRefGroup = A9794C802CB70ADA00527984 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
A9794C7E2CB70ADA00527984 /* RNG */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
A9794C7D2CB70ADA00527984 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
A9794C8B2CB70AE100527984 /* Preview Assets.xcassets in Resources */,
|
||||
A9794C872CB70AE100527984 /* Assets.xcassets in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
A9794C7B2CB70ADA00527984 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
A9794C962CB70C8000527984 /* PasswordView.swift in Sources */,
|
||||
A9794C852CB70ADA00527984 /* ContentView.swift in Sources */,
|
||||
A9794C922CB70BF600527984 /* DiceView.swift in Sources */,
|
||||
A9794C942CB70C1400527984 /* NumberView.swift in Sources */,
|
||||
A9794C832CB70ADA00527984 /* RNGApp.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
A9794C8C2CB70AE100527984 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
A9794C8D2CB70AE100527984 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
A9794C8F2CB70AE100527984 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_ENTITLEMENTS = RNG/RNG.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_ASSET_PATHS = "\"RNG/Preview Content\"";
|
||||
DEVELOPMENT_TEAM = 8626DL2GW3;
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES;
|
||||
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES;
|
||||
"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES;
|
||||
"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphonesimulator*]" = YES;
|
||||
"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]" = YES;
|
||||
"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]" = YES;
|
||||
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]" = UIStatusBarStyleDefault;
|
||||
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault;
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 16;
|
||||
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
|
||||
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 13;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.neon443.RNG;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = auto;
|
||||
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
A9794C902CB70AE100527984 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_ENTITLEMENTS = RNG/RNG.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_ASSET_PATHS = "\"RNG/Preview Content\"";
|
||||
DEVELOPMENT_TEAM = 8626DL2GW3;
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES;
|
||||
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES;
|
||||
"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES;
|
||||
"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphonesimulator*]" = YES;
|
||||
"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]" = YES;
|
||||
"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]" = YES;
|
||||
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]" = UIStatusBarStyleDefault;
|
||||
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault;
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 16;
|
||||
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
|
||||
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 13;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.neon443.RNG;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = auto;
|
||||
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
A9794C7A2CB70ADA00527984 /* Build configuration list for PBXProject "RNG" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
A9794C8C2CB70AE100527984 /* Debug */,
|
||||
A9794C8D2CB70AE100527984 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
A9794C8E2CB70AE100527984 /* Build configuration list for PBXNativeTarget "RNG" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
A9794C8F2CB70AE100527984 /* Debug */,
|
||||
A9794C902CB70AE100527984 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = A9794C772CB70ADA00527984 /* Project object */;
|
||||
}
|
||||
@@ -2,13 +2,7 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>SchemeUserState</key>
|
||||
<dict>
|
||||
<key>RNG.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
85
RNG.xcodeproj/xcshareddata/xcschemes/RNG.xcscheme
Normal file
85
RNG.xcodeproj/xcshareddata/xcschemes/RNG.xcscheme
Normal file
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1540"
|
||||
version = "1.7">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES"
|
||||
buildArchitectures = "Automatic">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "A9794C7E2CB70ADA00527984"
|
||||
BuildableName = "RNG.app"
|
||||
BlueprintName = "RNG"
|
||||
ReferencedContainer = "container:RNG.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
shouldAutocreateTestPlan = "YES">
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "A9794C7E2CB70ADA00527984"
|
||||
BuildableName = "RNG.app"
|
||||
BlueprintName = "RNG"
|
||||
ReferencedContainer = "container:RNG.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<EnvironmentVariables>
|
||||
<EnvironmentVariable
|
||||
key = "IDEPreferLogStreaming"
|
||||
value = "YES"
|
||||
isEnabled = "YES">
|
||||
</EnvironmentVariable>
|
||||
</EnvironmentVariables>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "A9794C7E2CB70ADA00527984"
|
||||
BuildableName = "RNG.app"
|
||||
BlueprintName = "RNG"
|
||||
ReferencedContainer = "container:RNG.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
11
RNG/Assets.xcassets/AccentColor.colorset/Contents.json
Normal file
11
RNG/Assets.xcassets/AccentColor.colorset/Contents.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"colors" : [
|
||||
{
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
63
RNG/Assets.xcassets/AppIcon.appiconset/Contents.json
Normal file
63
RNG/Assets.xcassets/AppIcon.appiconset/Contents.json
Normal file
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"platform" : "ios",
|
||||
"size" : "1024x1024"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"scale" : "1x",
|
||||
"size" : "16x16"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"scale" : "2x",
|
||||
"size" : "16x16"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"scale" : "1x",
|
||||
"size" : "32x32"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"scale" : "2x",
|
||||
"size" : "32x32"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"scale" : "1x",
|
||||
"size" : "128x128"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"scale" : "2x",
|
||||
"size" : "128x128"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"scale" : "1x",
|
||||
"size" : "256x256"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"scale" : "2x",
|
||||
"size" : "256x256"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"scale" : "1x",
|
||||
"size" : "512x512"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"scale" : "2x",
|
||||
"size" : "512x512"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
6
RNG/Assets.xcassets/Contents.json
Normal file
6
RNG/Assets.xcassets/Contents.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
59
RNG/ContentView.swift
Normal file
59
RNG/ContentView.swift
Normal file
@@ -0,0 +1,59 @@
|
||||
//
|
||||
// ContentView.swift
|
||||
// RNG
|
||||
//
|
||||
// Created by Nihaal on 09/10/2024.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ContentView: View {
|
||||
var body: some View {
|
||||
VStack {
|
||||
NavigationSplitView {
|
||||
List {
|
||||
NavigationLink {
|
||||
NumberView()
|
||||
.navigationTitle("Random Number Generator")
|
||||
} label: {
|
||||
HStack {
|
||||
Text("Random Number Generator")
|
||||
Spacer()
|
||||
Image(systemName: "textformat.123")
|
||||
}
|
||||
}
|
||||
NavigationLink {
|
||||
DiceView()
|
||||
.navigationTitle("Dice")
|
||||
} label: {
|
||||
HStack {
|
||||
Text("Dice")
|
||||
Spacer()
|
||||
Image(systemName: "die.face.1")
|
||||
Image(systemName: "die.face.2.fill")
|
||||
Image(systemName: "die.face.3")
|
||||
Image(systemName: "die.face.4.fill")
|
||||
Image(systemName: "die.face.5")
|
||||
Image(systemName: "die.face.6.fill")
|
||||
}
|
||||
}
|
||||
NavigationLink {
|
||||
PasswordView()
|
||||
.navigationTitle("Password")
|
||||
} label: {
|
||||
HStack {
|
||||
Text("Password")
|
||||
Spacer()
|
||||
Image(systemName: "rectangle.and.pencil.and.ellipsis")
|
||||
}
|
||||
}
|
||||
}
|
||||
.navigationTitle("RNG")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
} detail: {
|
||||
Image(systemName: "dice.fill")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
114
RNG/DiceView.swift
Normal file
114
RNG/DiceView.swift
Normal file
@@ -0,0 +1,114 @@
|
||||
//
|
||||
// DiceView.swift
|
||||
// RNG
|
||||
//
|
||||
// Created by Nihaal on 30/05/2024.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct DiceView: View {
|
||||
@State var generated: [Int] = [0]
|
||||
@State var displayDies: [Int] = []
|
||||
@State var displayMultiDieMode = ""
|
||||
@State var multiDieMode = "plus"
|
||||
@State var result = 0
|
||||
@State var resultDescription = ""
|
||||
@State var history: [Int] = []
|
||||
let columns = [GridItem(.adaptive(minimum: 25, maximum: 75))]
|
||||
@State var dies: Double = 2
|
||||
var body: some View {
|
||||
VStack {
|
||||
List {
|
||||
Section("Number of die") {
|
||||
HStack {
|
||||
Text( String( Int(dies) ) )
|
||||
.font(.system(size: 25, weight: .bold))
|
||||
Divider()
|
||||
Text("1")
|
||||
Slider(value: $dies, in: 1...20, step: 1)
|
||||
Text("20")
|
||||
}
|
||||
}
|
||||
Section("Multi die mode") {
|
||||
Picker(selection: $multiDieMode, label: Text("ioug")) {
|
||||
Image(systemName: "plus").tag("plus")
|
||||
Image(systemName: "multiply").tag("multiply")
|
||||
}.pickerStyle(SegmentedPickerStyle())
|
||||
}
|
||||
Section("Visual") {
|
||||
HStack {
|
||||
Spacer()
|
||||
if displayDies.isEmpty {
|
||||
Text("Results are visualised here when you press the generate button")
|
||||
.font(.subheadline)
|
||||
} else {
|
||||
LazyVGrid(columns: columns, spacing: 10) {
|
||||
ForEach(0..<displayDies.count, id: \.self) { index in
|
||||
Image(systemName: "die.face.\(displayDies[index])")
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.frame(width: 50, height: 50)
|
||||
if index != displayDies.count-1 {
|
||||
Image(systemName: displayMultiDieMode)
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.frame(width: 10, height: 10)
|
||||
}
|
||||
}
|
||||
}.padding()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Text(String(result))
|
||||
.font(.system(size: 75, weight: .bold))
|
||||
.foregroundColor(.gray)
|
||||
.frame(height: 50)
|
||||
Text(resultDescription)
|
||||
.frame(height: 20)
|
||||
Button {
|
||||
generated = rngN6DieArr(dies: Int(dies))
|
||||
displayDies = generated
|
||||
displayMultiDieMode = multiDieMode
|
||||
result = arrCombine(arr: generated, combineMode: multiDieMode)
|
||||
resultDescription = describeResult(inp: displayDies, combineMode: multiDieMode)
|
||||
} label: {
|
||||
Text("Generate")
|
||||
.padding(.horizontal)
|
||||
.font(.system(size: 25, weight: .bold))
|
||||
}
|
||||
.buttonStyle(BorderedProminentButtonStyle())
|
||||
.cornerRadius(15)
|
||||
.padding(.bottom)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func describeResult(inp: [Int], combineMode: String) -> String {
|
||||
let len = inp.count-1
|
||||
var result = ""
|
||||
var symbol = ""
|
||||
if inp.isEmpty {
|
||||
return "0"
|
||||
} else {
|
||||
if combineMode == "plus" {
|
||||
symbol = " + "
|
||||
} else if combineMode == "multiply" {
|
||||
symbol = " x "
|
||||
}
|
||||
for i in 0...len {
|
||||
if i == len {
|
||||
result += String(inp[i])
|
||||
} else {
|
||||
result += String(inp[i]) + symbol
|
||||
}
|
||||
}
|
||||
result += " = " + String(arrCombine(arr: inp, combineMode: combineMode))
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
DiceView()
|
||||
}
|
||||
175
RNG/NumberView.swift
Normal file
175
RNG/NumberView.swift
Normal file
@@ -0,0 +1,175 @@
|
||||
//
|
||||
// RNGView.swift
|
||||
// RNG
|
||||
//
|
||||
// Created by Nihaal on 09/10/2024.
|
||||
//
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//fix date created
|
||||
//TODO: readd ios 16 support
|
||||
//TODO: try to use inject
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct NumberView: View {
|
||||
@State var low: String = "1"
|
||||
@State var high: String = "10"
|
||||
@State var exclude: String = "none"
|
||||
@State var generated = "5"
|
||||
@State var prevGen = ""
|
||||
@State var generatedInt: Int = 0
|
||||
@State var prevGenInt: Int = 0
|
||||
@State var dispResult = 5
|
||||
var body: some View {
|
||||
List {
|
||||
HStack {
|
||||
Spacer()
|
||||
TextField("From", text: $low)
|
||||
.keyboardType(.numberPad)
|
||||
.textFieldStyle(RoundedBorderTextFieldStyle())
|
||||
.multilineTextAlignment(.center)
|
||||
Image(systemName: "minus")
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.bold()
|
||||
.frame(width: 20)
|
||||
TextField("To", text: $high)
|
||||
.keyboardType(.numberPad)
|
||||
.textFieldStyle(RoundedBorderTextFieldStyle())
|
||||
.multilineTextAlignment(.center)
|
||||
Spacer()
|
||||
}
|
||||
Section("Exclude") {
|
||||
Picker(selection: $exclude, label: Text("")) {
|
||||
Text("Start").tag("start")
|
||||
Text("None").tag("none")
|
||||
Text("End").tag("end")
|
||||
Text("Both").tag("both")
|
||||
}
|
||||
.pickerStyle(.segmented)
|
||||
}
|
||||
Section("Description") {
|
||||
Text(describeInputs(min: low, max: high, exclude: exclude))
|
||||
}
|
||||
}
|
||||
Text(String(dispResult))
|
||||
.font(.system(size: 75, weight: .bold))
|
||||
.foregroundColor(.gray)
|
||||
.frame(height: 50)
|
||||
Button {
|
||||
prevGen = generated
|
||||
generated = rng2(min: low, max: high, exclude: exclude)
|
||||
prevGenInt = Int(prevGen)!
|
||||
generatedInt = Int(generated)!
|
||||
if prevGenInt < generatedInt {
|
||||
for _ in prevGenInt...generatedInt {
|
||||
dispResult += 1
|
||||
//sleep( UInt32( 1 / (generatedInt - prevGenInt) ) )
|
||||
}
|
||||
} else if prevGenInt > generatedInt {
|
||||
for _ in generatedInt...prevGenInt {
|
||||
dispResult -= 1
|
||||
//sleep( UInt32( 1 / (prevGenInt - generatedInt) ) )
|
||||
}
|
||||
} else if prevGenInt == generatedInt {
|
||||
dispResult = generatedInt
|
||||
}
|
||||
} label: {
|
||||
Text("Generate")
|
||||
.padding(.horizontal)
|
||||
.font(.system(size: 25, weight: .bold))
|
||||
}
|
||||
.buttonStyle(BorderedProminentButtonStyle())
|
||||
.cornerRadius(15)
|
||||
.padding(.bottom)
|
||||
}
|
||||
}
|
||||
|
||||
func describeInputs(min: String, max: String, exclude: String) -> String {
|
||||
let validExcludes = ["start", "end", "both", "none"]
|
||||
guard validExcludes.contains(exclude) else {
|
||||
print("invalid exclude: " + exclude)
|
||||
return "invalid exclude: " + exclude
|
||||
}
|
||||
|
||||
var result = "Any number from "
|
||||
result += min != "" ? min : "_"
|
||||
result += " to "
|
||||
result += max != "" ? max : "_"
|
||||
|
||||
if min == "" || max == "" {
|
||||
return "Enter values above."
|
||||
} else {
|
||||
switch exclude {
|
||||
case "start":
|
||||
result += ", excluding \(min)"
|
||||
case "end":
|
||||
result += ", excluding \(max)"
|
||||
case "both":
|
||||
result += ", excluding \(min) and \(max)"
|
||||
case "none":
|
||||
break
|
||||
default:
|
||||
result = "invalid 'exclude'"
|
||||
}
|
||||
}
|
||||
result += "."
|
||||
return result
|
||||
}
|
||||
|
||||
enum rng2Errors: Error {
|
||||
case h
|
||||
}
|
||||
|
||||
func rng2(min: String, max: String, exclude: String) -> String {
|
||||
guard min != "" || max != "" else {
|
||||
return "Enter values above."
|
||||
}
|
||||
guard var minInt = Int(min) else {
|
||||
print("invalid min")
|
||||
return "-1"
|
||||
}
|
||||
guard var maxInt = Int(max), maxInt >= minInt else {
|
||||
print("invalid max or is less than min")
|
||||
return "-1"
|
||||
}
|
||||
guard exclude != "both", min != max else {
|
||||
print("excluding both but min == max")
|
||||
return "No possible numbers, both bounds equal."
|
||||
}
|
||||
let minIntPlus1 = minInt + 1
|
||||
guard exclude != "both", minIntPlus1 != maxInt else {
|
||||
print("excluding both but min +1 == max")
|
||||
return "No possible numbers."
|
||||
}
|
||||
var generated = 0
|
||||
if exclude == "both" {
|
||||
maxInt -= 1
|
||||
minInt += 1
|
||||
} else if exclude == "start" {
|
||||
minInt += 1
|
||||
} else if exclude == "end" {
|
||||
maxInt -= 1
|
||||
}
|
||||
generated = rng(min: minInt, max: maxInt)
|
||||
return String(generated)
|
||||
}
|
||||
|
||||
#Preview {
|
||||
NumberView()
|
||||
}
|
||||
122
RNG/PasswordView.swift
Normal file
122
RNG/PasswordView.swift
Normal file
@@ -0,0 +1,122 @@
|
||||
//
|
||||
// PasswordView.swift
|
||||
// RNG
|
||||
//
|
||||
// Created by Nihaal on 30/05/2024.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct PasswordView: View {
|
||||
@State var selectedOptions: [PassOption] = []
|
||||
let options: [PassOption] = [
|
||||
PassOption(name: "0-9", chars: Array("0123456789")),
|
||||
PassOption(name: "a-z", chars: Array("abcdefghijklmnopqrstuvwxyz")),
|
||||
PassOption(name: "A-Z", chars: Array("ABCDEFGHIJKLMNOPQRSTUVWXYZ"))
|
||||
]
|
||||
@State var presetLen = 4
|
||||
@State var customLen = 8
|
||||
@State var generated = ""
|
||||
@State var result = ""
|
||||
@State var history: [Int] = []
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
List {
|
||||
Text("Hello, world!")
|
||||
.font(.largeTitle)
|
||||
.foregroundColor(.white)
|
||||
.padding()
|
||||
.background(Color.blue)
|
||||
.padding()
|
||||
.background(Color.mint)
|
||||
.padding()
|
||||
.background(Color.green)
|
||||
|
||||
Section("Include") {
|
||||
ForEach(options) { option in
|
||||
Toggle(isOn: Binding(
|
||||
get: {
|
||||
self.selectedOptions.contains(where: { $0.id == option.id })
|
||||
},
|
||||
set: { isSelected in
|
||||
if isSelected {
|
||||
self.selectedOptions.append(option)
|
||||
} else {
|
||||
self.selectedOptions.removeAll { $0.id == option.id }
|
||||
}
|
||||
}
|
||||
)) {
|
||||
Text(option.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Section("Length") {
|
||||
Picker("", selection: $presetLen) {
|
||||
Text("4").tag(4)
|
||||
Text("6").tag(6)
|
||||
Text("Custom: \(customLen)").tag(-1)
|
||||
}
|
||||
.pickerStyle(SegmentedPickerStyle())
|
||||
}
|
||||
|
||||
if presetLen == -1 {
|
||||
TextField("Custom", value: $customLen, formatter: NumberFormatter())
|
||||
.keyboardType(.numberPad)
|
||||
.frame(width: 50)
|
||||
}
|
||||
|
||||
Text(String(result))
|
||||
.font(.system(size: 75, weight: .bold))
|
||||
.foregroundColor(.gray)
|
||||
.frame(height: 50)
|
||||
|
||||
Text(String(generated))
|
||||
.font(.system(size: 75, weight: .bold))
|
||||
.foregroundColor(.gray)
|
||||
.frame(height: 50)
|
||||
|
||||
Button {
|
||||
generated = genPass(selectdOpts: selectedOptions, len: (presetLen == -1 ? customLen : presetLen))
|
||||
} label: {
|
||||
Text("Generate")
|
||||
.padding(.horizontal)
|
||||
.font(.system(size: 25, weight: .bold))
|
||||
}
|
||||
.buttonStyle(BorderedProminentButtonStyle())
|
||||
.cornerRadius(15)
|
||||
.padding(.vertical)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
struct Option: Identifiable {
|
||||
let id: Int
|
||||
let name: String
|
||||
}
|
||||
|
||||
struct PassOption: Identifiable {
|
||||
var id = UUID()
|
||||
var name: String
|
||||
var chars: [Character]
|
||||
}
|
||||
|
||||
func genPass(selectdOpts: [PassOption], len: Int) -> String {
|
||||
let characters = selectdOpts.flatMap { $0.chars }
|
||||
|
||||
guard !(characters.isEmpty) else {
|
||||
print("characters empty")
|
||||
return ""
|
||||
}
|
||||
|
||||
return (0..<len).compactMap { _ in
|
||||
characters.randomElement()
|
||||
}
|
||||
.map { String($0) }
|
||||
.joined()
|
||||
}
|
||||
|
||||
#Preview {
|
||||
PasswordView()
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,9 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>AppSettings</key>
|
||||
<dict>
|
||||
<key>appIconPlaceholderGlyphName</key>
|
||||
<string>calculator</string>
|
||||
<key>appSettingsVersion</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
<key>com.apple.security.app-sandbox</key>
|
||||
<true/>
|
||||
<key>com.apple.security.files.user-selected.read-only</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
110
RNG/RNGApp.swift
Normal file
110
RNG/RNGApp.swift
Normal file
@@ -0,0 +1,110 @@
|
||||
//
|
||||
// RNGApp.swift
|
||||
// RNG
|
||||
//
|
||||
// Created by Nihaal on 24/05/2024.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
@main
|
||||
struct RNGApp: App {
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
ContentView()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// array combiner, adds up all ints in an array
|
||||
func totalIntArr(arr: [Int]) -> Int {
|
||||
var total = 0
|
||||
for num in arr {
|
||||
total += num
|
||||
}
|
||||
return total
|
||||
}
|
||||
|
||||
// array combiner, adds up all doubles in an array
|
||||
func totalDoubleArr(arr: [Double]) -> Double {
|
||||
var total: Double = 0
|
||||
for num in arr {
|
||||
total += num
|
||||
}
|
||||
return total
|
||||
}
|
||||
|
||||
// array combiner, adds or multiplies all ints in an array
|
||||
func arrCombine(arr: [Int], combineMode: String) -> Int {
|
||||
var output = 0
|
||||
if combineMode == "plus" {
|
||||
for num in arr {
|
||||
output += num
|
||||
}
|
||||
} else if combineMode == "multiply" {
|
||||
output = 1
|
||||
for num in arr {
|
||||
output *= num
|
||||
}
|
||||
} else {
|
||||
print("invalid combineMode '\(combineMode)'. must be 'plus' or 'multiply', returning 0")
|
||||
return 0
|
||||
}
|
||||
return output
|
||||
}
|
||||
|
||||
|
||||
func rng(min: Int, max: Int) -> Int {
|
||||
var rng = 0
|
||||
rng = Int.random(in: min...max)
|
||||
return rng
|
||||
}
|
||||
|
||||
func rng6Die() -> Int {
|
||||
return Int.random(in: 1...6)
|
||||
}
|
||||
|
||||
func rngCDie(min: Int, max: Int) -> Int {
|
||||
return Int.random(in: min...max)
|
||||
}
|
||||
|
||||
func rngN6DieArr(dies: Int) -> [Int] {
|
||||
var output: [Int] = []
|
||||
for _ in 1...dies {
|
||||
output.append(rng6Die())
|
||||
}
|
||||
return output
|
||||
}
|
||||
|
||||
func rngNCDie(dies: Int, min: Int, max: Int) -> [Int] {
|
||||
var output: [Int] = []
|
||||
for _ in 1...dies {
|
||||
output.append(rngCDie(min: min, max: max))
|
||||
}
|
||||
return output
|
||||
}
|
||||
|
||||
func rngInt(len: Int) async -> Int {
|
||||
var resultI: Int = 0
|
||||
var latestElement = 0
|
||||
for _ in 1...len {
|
||||
latestElement = Int.random(in: 0...9)
|
||||
if latestElement == 0 {
|
||||
resultI *= 10
|
||||
} else {
|
||||
resultI *= 10
|
||||
resultI += latestElement
|
||||
}
|
||||
}
|
||||
return resultI
|
||||
}
|
||||
|
||||
func rngString(len: Int) -> String {
|
||||
let letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
||||
return String((1..<len).map{ _ in letters.randomElement()! })
|
||||
|
||||
}
|
||||
|
||||
#Preview("ContentView") {
|
||||
ContentView()
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
import SwiftUI
|
||||
|
||||
struct CustomRNGView: View {
|
||||
@State var rangeL: String = ""
|
||||
@State var rangeH: String = ""
|
||||
@State var show = false
|
||||
var body: some View {
|
||||
Text("Unimplemented")
|
||||
Form {
|
||||
HStack {
|
||||
TextField("From", text: $rangeL)
|
||||
.keyboardType(.numberPad)
|
||||
Divider()
|
||||
TextField("To", text: $rangeH)
|
||||
.keyboardType(.numberPad)
|
||||
}
|
||||
HStack {
|
||||
Text("Any number")
|
||||
Divider()
|
||||
HStack {
|
||||
Text("From: ")
|
||||
Text(rangeL)
|
||||
Spacer()
|
||||
}
|
||||
HStack {
|
||||
Text("To: ")
|
||||
Text(rangeH)
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
CustomRNGView()
|
||||
}
|
||||
Reference in New Issue
Block a user