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 | |
extension View where Self: Shape { | |
func glow( | |
fill: some ShapeStyle, | |
lineWidth: Double, | |
blurRadius: Double = 8.0, | |
lineCap: CGLineCap = .round | |
) -> some View { | |
self |
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 | |
// MARK: - Scroll Behavior | |
/// A structure that defines a snapping behavior for scroll targets, conforming to `ScrollTargetBehavior`. | |
struct SnapScrollTargetBehavior: ScrollTargetBehavior { | |
/// The step value to which the scroll target should snap. | |
let step: Double | |
/// Computes the closest multiple of `b` to the given value `a`. |
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 | |
/// Represents Apple's "Hello" greeting. | |
/// Requires .frame(width: 1212, height: 401) canvas to display correctly | |
struct HelloShape: Shape { | |
func path(in rect: CGRect) -> Path { | |
var shape = Path() | |
shape.move(to: CGPoint(x: 18, y: 362.78)) | |
shape.addCurve(to: CGPoint(x: 255.5, y: 72.78), control1: CGPoint(x: 123.36, y: 301.04), control2: CGPoint(x: 240.76, y: 204.38)) |
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 UIKit | |
let reuseIdentifier = "cellIdentifier" | |
class MagicController: UIViewController { | |
let data: [ViewData] = DataProvider.data | |
lazy var tableView: UITableView = { | |
let view = UITableView() |
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 UIKit | |
let kPadding: CGFloat = 20 | |
let kAnimationDuration: TimeInterval = 0.3 | |
let kAnimationDelay: TimeInterval = 0 | |
let kTextSpacing: CGFloat = 10 | |
let kFondSize: CGFloat = 20 | |
class MagicCell: UITableViewCell { |
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 News { | |
let title: String | |
let summary: String | |
let date: String | |
} | |
class ViewData { | |
private let raw: News | |
var expanded: Bool | |
var title: String { raw.title } |
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
""" | |
MIT License | |
Copyright (c) 2017 Cyrille Rossant | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |