Skip to content

Commit 2ab3d2f

Browse files
committed
Making it look somewhat pretty
1 parent 824569b commit 2ab3d2f

File tree

13 files changed

+301
-24
lines changed

13 files changed

+301
-24
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,6 @@ fastlane/test_output
8888
# https://github.com/johnno1962/injectionforxcode
8989

9090
iOSInjectionProject/
91+
92+
# macOS Files
93+
.DS_Store

Operator.sketch

-15.4 KB
Binary file not shown.

Operator.xcodeproj/project.pbxproj

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@
2626
729E6FE6246CE2AC0015B30D /* sample-modified.aif in Resources */ = {isa = PBXBuildFile; fileRef = 722F0F2B246CE18800C857E9 /* sample-modified.aif */; };
2727
729E6FE7246CE2AF0015B30D /* sample-adjusted.aif in Resources */ = {isa = PBXBuildFile; fileRef = 72704C962460F099006F3E99 /* sample-adjusted.aif */; };
2828
72A22CDD247058A700978DE6 /* Compression_Algorithm+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72A22CDC247058A700978DE6 /* Compression_Algorithm+Extensions.swift */; };
29+
72B75561247174D100FA8B3B /* BulletedVStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72B75560247174D100FA8B3B /* BulletedVStack.swift */; };
30+
72B7556324717EAE00FA8B3B /* CircleBullet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72B7556224717EAE00FA8B3B /* CircleBullet.swift */; };
31+
72BDC2A42470BE1100361464 /* NeumorphicButtonStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72BDC2A32470BE1100361464 /* NeumorphicButtonStyle.swift */; };
32+
72BDC2A62470BEB000361464 /* AppleButtonStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72BDC2A52470BEB000361464 /* AppleButtonStyle.swift */; };
33+
72BDC2A82470C2A000361464 /* UIColor+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72BDC2A72470C2A000361464 /* UIColor+Extensions.swift */; };
34+
72BDC2AA2470C2BB00361464 /* Colors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72BDC2A92470C2BB00361464 /* Colors.swift */; };
2935
72C77F49247048B6003907E7 /* DocumentPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72C77F48247048B6003907E7 /* DocumentPicker.swift */; };
3036
72F291062470523A00561B16 /* FolderCompressor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72F291052470523A00561B16 /* FolderCompressor.swift */; };
3137
72F291082470561100561B16 /* FileHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72F291072470561100561B16 /* FileHelper.swift */; };
@@ -70,6 +76,12 @@
7076
72704C8F2460EFEB006F3E99 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
7177
72704C962460F099006F3E99 /* sample-adjusted.aif */ = {isa = PBXFileReference; lastKnownFileType = file; path = "sample-adjusted.aif"; sourceTree = "<group>"; };
7278
72A22CDC247058A700978DE6 /* Compression_Algorithm+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Compression_Algorithm+Extensions.swift"; sourceTree = "<group>"; };
79+
72B75560247174D100FA8B3B /* BulletedVStack.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BulletedVStack.swift; sourceTree = "<group>"; };
80+
72B7556224717EAE00FA8B3B /* CircleBullet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CircleBullet.swift; sourceTree = "<group>"; };
81+
72BDC2A32470BE1100361464 /* NeumorphicButtonStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NeumorphicButtonStyle.swift; sourceTree = "<group>"; };
82+
72BDC2A52470BEB000361464 /* AppleButtonStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppleButtonStyle.swift; sourceTree = "<group>"; };
83+
72BDC2A72470C2A000361464 /* UIColor+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIColor+Extensions.swift"; sourceTree = "<group>"; };
84+
72BDC2A92470C2BB00361464 /* Colors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Colors.swift; sourceTree = "<group>"; };
7385
72C77F48247048B6003907E7 /* DocumentPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DocumentPicker.swift; sourceTree = "<group>"; };
7486
72F291052470523A00561B16 /* FolderCompressor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FolderCompressor.swift; sourceTree = "<group>"; };
7587
72F291072470561100561B16 /* FileHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileHelper.swift; sourceTree = "<group>"; };
@@ -109,6 +121,7 @@
109121
children = (
110122
72352438246D006D00F58C61 /* String+Extensions.swift */,
111123
72A22CDC247058A700978DE6 /* Compression_Algorithm+Extensions.swift */,
124+
72BDC2A72470C2A000361464 /* UIColor+Extensions.swift */,
112125
);
113126
path = Extensions;
114127
sourceTree = "<group>";
@@ -223,6 +236,7 @@
223236
72704C832460EF94006F3E99 /* Infrastructure */ = {
224237
isa = PBXGroup;
225238
children = (
239+
72BDC2A22470BE0000361464 /* UI */,
226240
726A21F7247025F300DBAB87 /* USB */,
227241
726A21EF24701C2A00DBAB87 /* Logging */,
228242
72352437246D006200F58C61 /* Extensions */,
@@ -258,6 +272,18 @@
258272
path = "Test Files";
259273
sourceTree = "<group>";
260274
};
275+
72BDC2A22470BE0000361464 /* UI */ = {
276+
isa = PBXGroup;
277+
children = (
278+
72BDC2A32470BE1100361464 /* NeumorphicButtonStyle.swift */,
279+
72BDC2A52470BEB000361464 /* AppleButtonStyle.swift */,
280+
72BDC2A92470C2BB00361464 /* Colors.swift */,
281+
72B75560247174D100FA8B3B /* BulletedVStack.swift */,
282+
72B7556224717EAE00FA8B3B /* CircleBullet.swift */,
283+
);
284+
path = UI;
285+
sourceTree = "<group>";
286+
};
261287
72F291092470569000561B16 /* Compressor */ = {
262288
isa = PBXGroup;
263289
children = (
@@ -464,19 +490,25 @@
464490
buildActionMask = 2147483647;
465491
files = (
466492
726A2201247043A400DBAB87 /* BackupView.swift in Sources */,
493+
72BDC2AA2470C2BB00361464 /* Colors.swift in Sources */,
467494
72352439246D006D00F58C61 /* String+Extensions.swift in Sources */,
468495
72F291062470523A00561B16 /* FolderCompressor.swift in Sources */,
469496
72704C862460EFB7006F3E99 /* AudioFile.swift in Sources */,
470497
72A22CDD247058A700978DE6 /* Compression_Algorithm+Extensions.swift in Sources */,
471498
726A21FF2470439800DBAB87 /* BackupViewModel.swift in Sources */,
472499
72F291082470561100561B16 /* FileHelper.swift in Sources */,
473500
72C77F49247048B6003907E7 /* DocumentPicker.swift in Sources */,
501+
72B75561247174D100FA8B3B /* BulletedVStack.swift in Sources */,
474502
726A21F124701C4800DBAB87 /* Log.swift in Sources */,
475503
726A21F324701C5D00DBAB87 /* LogFormatter.swift in Sources */,
504+
72BDC2A62470BEB000361464 /* AppleButtonStyle.swift in Sources */,
476505
72704C6B2460EF10006F3E99 /* AppDelegate.swift in Sources */,
477506
72704C6D2460EF10006F3E99 /* SceneDelegate.swift in Sources */,
478507
72704C6F2460EF10006F3E99 /* HomeView.swift in Sources */,
479508
726A21FB24702E3C00DBAB87 /* Application.swift in Sources */,
509+
72BDC2A42470BE1100361464 /* NeumorphicButtonStyle.swift in Sources */,
510+
72BDC2A82470C2A000361464 /* UIColor+Extensions.swift in Sources */,
511+
72B7556324717EAE00FA8B3B /* CircleBullet.swift in Sources */,
480512
72F2910B2470569E00561B16 /* Compressor.swift in Sources */,
481513
726A21F92470260A00DBAB87 /* DeviceLocator.swift in Sources */,
482514
);

Operator/Infrastructure/Extensions/String+Extensions.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,19 @@
99
import Foundation
1010

1111
extension String {
12-
subscript (bounds: CountableClosedRange<Int>) -> String {
12+
subscript(bounds: CountableClosedRange<Int>) -> String {
1313
let start = index(startIndex, offsetBy: bounds.lowerBound)
1414
let end = index(startIndex, offsetBy: bounds.upperBound)
15-
return String(self[start...end])
15+
return String(self[start ... end])
1616
}
1717

18-
subscript (bounds: CountableRange<Int>) -> String {
18+
subscript(bounds: CountableRange<Int>) -> String {
1919
let start = index(startIndex, offsetBy: bounds.lowerBound)
2020
let end = index(startIndex, offsetBy: bounds.upperBound)
21-
return String(self[start..<end])
21+
return String(self[start ..< end])
22+
}
23+
24+
func localized(comment: String = "") -> String {
25+
return NSLocalizedString(self, comment: comment)
2226
}
2327
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
//
2+
// UIColor+Extensions.swift
3+
// Operator
4+
//
5+
// Created by Brian Michel on 5/16/20.
6+
// Copyright © 2020 Brian Michel. All rights reserved.
7+
//
8+
9+
import Foundation
10+
11+
import UIKit
12+
13+
extension UIColor {
14+
convenience init?(hex: String) {
15+
var hexSanitized = hex.trimmingCharacters(in: .whitespacesAndNewlines)
16+
hexSanitized = hexSanitized.replacingOccurrences(of: "#", with: "")
17+
18+
var rgb: UInt64 = 0
19+
20+
var red: CGFloat = 0.0
21+
var green: CGFloat = 0.0
22+
var blue: CGFloat = 0.0
23+
var alpha: CGFloat = 1.0
24+
25+
let length = hexSanitized.count
26+
27+
guard Scanner(string: hexSanitized).scanHexInt64(&rgb) else { return nil }
28+
29+
if length == 6 {
30+
red = CGFloat((rgb & 0xFF0000) >> 16) / 255.0
31+
green = CGFloat((rgb & 0x00FF00) >> 8) / 255.0
32+
blue = CGFloat(rgb & 0x0000FF) / 255.0
33+
34+
} else if length == 8 {
35+
red = CGFloat((rgb & 0xFF00_0000) >> 24) / 255.0
36+
green = CGFloat((rgb & 0x00FF_0000) >> 16) / 255.0
37+
blue = CGFloat((rgb & 0x0000_FF00) >> 8) / 255.0
38+
alpha = CGFloat(rgb & 0x0000_00FF) / 255.0
39+
40+
} else {
41+
return nil
42+
}
43+
44+
self.init(red: red, green: green, blue: blue, alpha: alpha)
45+
}
46+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//
2+
// AppleButtonStyle.swift
3+
// Operator
4+
//
5+
// Created by Brian Michel on 5/16/20.
6+
// Copyright © 2020 Brian Michel. All rights reserved.
7+
//
8+
9+
import SwiftUI
10+
11+
struct AppleButtonStyle: ButtonStyle {
12+
var backgroundColor: Color = Color(Colors.op1Blue)
13+
var foregroundColor: Color = .white
14+
15+
func makeBody(configuration: Self.Configuration) -> some View {
16+
configuration.label
17+
.padding()
18+
.frame(minWidth: 0, maxWidth: .infinity)
19+
.background(
20+
RoundedRectangle(cornerRadius: 16, style: .continuous)
21+
.fill(configuration.isPressed ? backgroundColor.opacity(0.8) : backgroundColor)
22+
)
23+
.scaleEffect(configuration.isPressed ? 0.95 : 1)
24+
.foregroundColor(foregroundColor).font(.system(size: 20, weight: .medium, design: .default))
25+
.animation(.spring())
26+
}
27+
}
28+
29+
struct AppleButtonStyle_Previews: PreviewProvider {
30+
static var previews: some View {
31+
Button(action: {}, label: {
32+
Text("Hi, I'm a button")
33+
}).buttonStyle(AppleButtonStyle(backgroundColor: .red))
34+
}
35+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
//
2+
// BulletedVStack.swift
3+
// Operator
4+
//
5+
// Created by Brian Michel on 5/17/20.
6+
// Copyright © 2020 Brian Michel. All rights reserved.
7+
//
8+
9+
import SwiftUI
10+
11+
struct BulletedVStack: View {
12+
let items: [String]
13+
var font: Font = Font.system(size: 30, weight: .regular, design: .default)
14+
15+
var bulletColor: Color = .secondary
16+
var spacing: CGFloat = 10
17+
18+
var body: some View {
19+
VStack(alignment: .leading, spacing: self.spacing) {
20+
ForEach(items, id: \.self) { item in
21+
HStack(alignment: .center, spacing: 20) {
22+
CircleBullet(
23+
text: "\(self.items.firstIndex(of: item)! + 1)",
24+
backgroundColor: self.bulletColor,
25+
foregroundColor: .white
26+
).frame(maxWidth: 23, maxHeight: 23)
27+
Text(item).font(self.font)
28+
}
29+
}
30+
}
31+
}
32+
}
33+
34+
struct BulletedVStack_Previews: PreviewProvider {
35+
static var previews: some View {
36+
BulletedVStack(items: [
37+
"This is just one thing that should be on the list",
38+
"Here's another thing that should be on the list, but it's even longer so we can see wrapping behavior",
39+
"finally here's a short thing :)",
40+
])
41+
}
42+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
//
2+
// CircleBullet.swift
3+
// Operator
4+
//
5+
// Created by Brian Michel on 5/17/20.
6+
// Copyright © 2020 Brian Michel. All rights reserved.
7+
//
8+
9+
import SwiftUI
10+
11+
struct CircleBullet: View {
12+
var text: String
13+
14+
var backgroundColor: Color = .secondary
15+
var foregroundColor: Color = .primary
16+
17+
var body: some View {
18+
GeometryReader { reader in
19+
ZStack {
20+
Circle().foregroundColor(self.backgroundColor)
21+
Text(self.text)
22+
.foregroundColor(self.foregroundColor)
23+
.font(.system(size: reader.size.height > reader.size.width ? reader.size.width * 0.6 : reader.size.height * 0.6, weight: .bold, design: .rounded))
24+
}
25+
}
26+
}
27+
}
28+
29+
struct CircleBullet_Previews: PreviewProvider {
30+
static var previews: some View {
31+
Group {
32+
CircleBullet(text: "1").frame(maxWidth: 40, maxHeight: 40)
33+
CircleBullet(text: "2")
34+
CircleBullet(text: "3", backgroundColor: .red)
35+
}
36+
}
37+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//
2+
// Colors.swift
3+
// Operator
4+
//
5+
// Created by Brian Michel on 5/16/20.
6+
// Copyright © 2020 Brian Michel. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
enum Colors {
12+
static let op1Gray = UIColor(hex: "D1D4DE")!
13+
static let op1Blue = UIColor(hex: "76B8EC")!
14+
static let op1Green = UIColor(hex: "3BCA7A")!
15+
static let op1White = UIColor(hex: "FDFAFC")!
16+
static let op1Orange = UIColor(hex: "F0633F")!
17+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//
2+
// NeumorphicButtonStyle.swift
3+
// Operator
4+
//
5+
// Created by Brian Michel on 5/16/20.
6+
// Copyright © 2020 Brian Michel. All rights reserved.
7+
//
8+
9+
import SwiftUI
10+
11+
struct NeumorphicButtonStyle: ButtonStyle {
12+
var backgroundColor: Color
13+
14+
func makeBody(configuration: Self.Configuration) -> some View {
15+
configuration.label
16+
.padding(20)
17+
.background(
18+
ZStack {
19+
RoundedRectangle(cornerRadius: 10, style: .continuous)
20+
.shadow(color: .white, radius: configuration.isPressed ? 7 : 10, x: configuration.isPressed ? -5 : -15, y: configuration.isPressed ? -5 : -15)
21+
.shadow(color: .black, radius: configuration.isPressed ? 7 : 10, x: configuration.isPressed ? 5 : 15, y: configuration.isPressed ? 5 : 15)
22+
.blendMode(.overlay)
23+
RoundedRectangle(cornerRadius: 10, style: .continuous)
24+
.fill(backgroundColor)
25+
}
26+
)
27+
.scaleEffect(configuration.isPressed ? 0.95 : 1)
28+
.foregroundColor(.primary)
29+
.animation(.spring())
30+
}
31+
}
32+
33+
struct NeumorphicButtonStyle_Previews: PreviewProvider {
34+
static var previews: some View {
35+
Button(action: {}, label: {
36+
Text("Hi, I'm a button")
37+
}).buttonStyle(NeumorphicButtonStyle(backgroundColor: .red))
38+
}
39+
}

0 commit comments

Comments
 (0)