This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Used to detect specific issue with JSON decoding | |
func decodeOrReport(data: Data) { | |
do { | |
let _ = try JSONDecoder().decode(WidgetResponse.self, from: data) | |
print("\n\n👍ALL GOOD\n\n") | |
} catch DecodingError.keyNotFound( let key, let context) { | |
print("\n\n⛔️FAILED TO DECODE\n\n") | |
print("could not find key \(key) in JSON: \(context.debugDescription)") | |
} catch DecodingError.valueNotFound( let type, let context) { | |
print("\n\n⛔️FAILED TO DECODE\n\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct AnimationWithReduceMotion<V: Equatable>: ViewModifier { | |
@Environment(\.accessibilityReduceMotion) | |
private var reduceMotion | |
var animation: Animation? | |
let value: V | |
func body(content: Content) -> some View { | |
content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct MaterialView: View { | |
var foregroundColor: Color = Color.purple | |
let text: String | |
var body: some View { | |
Text(text) | |
.padding() | |
.background(.quaternary) | |
.foregroundStyle(foregroundColor) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
import CoreMotion | |
struct CMMotionManagerTest: View { | |
@StateObject var motion = MotionManager() | |
var body: some View { | |
ZStack { | |
Color.purple |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@main | |
struct mainApp: App { | |
init() { | |
// custom init if needed. Analytics setup and similar | |
} | |
var body: some Scene { | |
WindowGroup { | |
MainView(mainObservableObject: MainObservableObject()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct ContentView: View { | |
let rows = Array(repeating: GridItem(), count: 10) | |
@State var change: Bool = false { | |
didSet { | |
toggle() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct Ring: View { | |
var body: some View { | |
HStack { | |
Spacer() | |
ZStack(alignment: .trailing) { | |
Circle() | |
.strokeBorder(Color.circleGradientColor, lineWidth: 50) | |
Circle() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Color { | |
// MARK: Gradients | |
static var backgroundGradient = LinearGradient(colors: [Color(hex: "#50A7F7"), Color(hex: "#2566F6")], startPoint: .top, endPoint: .bottom) | |
static var topWaterColor = Color(hex: "#739BF7") | |
static var midWaterColor = Color(hex: "#5989F5") | |
static var backWaterColor = Color(hex: "#4979E7") | |
static var buttonGradient = LinearGradient(colors: [Color(hex: "#F4F8FA"), Color(hex: "#B6CCF7")], startPoint: .top, endPoint: .bottom) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct ContentViewWatch: View { | |
@State var selection = 0 | |
var body: some View { | |
VStack { | |
Picker("Haptic Type", selection: $selection) { | |
Text("notification").tag(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct Blender: Identifiable { | |
let id = UUID() | |
let mode: BlendMode | |
let name: String | |
} | |
struct BlendModes: View { |
NewerOlder