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
// | |
// HalfSheetWithUIKitForSwiftUI.swift | |
// TestAppForNewThinks | |
// | |
// Created by Hasan Ali Şişeci on 23.12.2023. | |
// | |
import SwiftUI | |
extension View { |
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
// Full recipe at https://swiftuirecipes.com/blog/swiftui-list-custom-row-swipe-actions-all-versions | |
import SwiftUI | |
// Button in swipe action, renders text or image and can have background color | |
struct SwipeActionButton: View, Identifiable { | |
static let width: CGFloat = 70 | |
let id = UUID() | |
let text: Text? |
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
// Author: SwiftUI-Lab (www.swiftui-lab.com) | |
// Description: This code is part of the "Advanced SwiftUI Animations - Part 5" | |
// Article: https://swiftui-lab.com/swiftui-animations-part5/ | |
import SwiftUI | |
struct ContentView: View { | |
var body: some View { | |
DigitalRain() | |
} |
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
// Author: SwiftUI-Lab (www.swiftui-lab.com) | |
// Description: This code is part of the "Advanced SwiftUI Animations - Part 5" | |
// Article: https://swiftui-lab.com/swiftui-animations-part5/ | |
import SwiftUI | |
struct ContentView: View { | |
var body: some View { | |
ClockView() | |
.background(.gray) |
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
// full recipe at https://swiftuirecipes.com/blog/swiftui-text-with-html-via-nsattributedstring | |
extension Text { | |
init(html htmlString: String, | |
raw: Bool = false, | |
size: CGFloat? = nil, | |
fontFamily: String = "-apple-system") { | |
let fullHTML: String | |
if raw { | |
fullHTML = htmlString | |
} else { |
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 | |
let buttonWidth: CGFloat = 60 | |
enum CellButtons: Identifiable { | |
case edit | |
case delete | |
case save | |
case info | |
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
// 1 | |
struct GenericList<Element, RowContent: View>: View where Element: Identifiable { | |
// 2 | |
private let items: [Element] | |
private let rowContent: (Element) -> RowContent | |
// 3 | |
public init(_ items: [Element], @ViewBuilder rowContent: @escaping (Element) -> RowContent) { | |
self.items = items |
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 Triangle: View { | |
let direction: Direction | |
let color: Color | |
init(_ direction: Direction = .down, _ color: Color = .black) { | |
self.direction = direction | |
self.color = color | |
} | |
var body: some View { |
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
// Safely Modifying The View State (SwiftUI) | |
// https://swiftui-lab.com | |
// https://swiftui-lab.com/state-changes | |
import SwiftUI | |
struct CustomView: View { | |
var body: some View { | |
NavigationView { |
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
// | |
// DispatchQueueDelay.swift | |
// | |
// Created by C. Bess on 9/17/19. | |
// MIT - Soli Deo gloria - perfectGod.com | |
// | |
// refs: | |
// - https://gist.github.com/fjcaetano/ff3e994c4edb4991ab8280f34994beb4 | |
// - https://www.craftappco.com/blog/2018/5/30/simple-throttling-in-swift |
NewerOlder