ℹ️ This article is also available on his blog.
Layout and Drawing are two different things:
- Layout defines only the positions and sizes of all views on screen.
- Drawing specifies how each view is rendered (how it looks).
ℹ️ This article is also available on his blog.
Layout and Drawing are two different things:
ℹ️ This article is also available on his blog.
Layout and Drawing are two different things:
| import SwiftSyntax | |
| import SwiftSemantics | |
| import Foundation | |
| let source = try! String(contentsOf: URL(fileURLWithPath: "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/SwiftUI.framework/Modules/SwiftUI.swiftmodule/arm64e.swiftinterface")) | |
| var collector = DeclarationCollector() | |
| let tree = try SyntaxParser.parse(source: source) | |
| tree.walk(&collector) |
| // | |
| // BottomSheetView.swift | |
| // | |
| // Created by Majid Jabrayilov | |
| // Copyright © 2019 Majid Jabrayilov. All rights reserved. | |
| // | |
| import SwiftUI | |
| fileprivate enum Constants { | |
| static let radius: CGFloat = 16 |
| // | |
| // PagerView.swift | |
| // | |
| // Created by Majid Jabrayilov on 12/5/19. | |
| // Copyright © 2019 Majid Jabrayilov. All rights reserved. | |
| // | |
| import SwiftUI | |
| struct PagerView<Content: View>: View { | |
| let pageCount: Int |
| (extension in :Animatable< where A.AnimatableData == EmptyAnimatableData>.animatableData.getter : EmptyAnimatableData | |
| (extension in :Animatable< where A.AnimatableData == EmptyAnimatableData>.animatableData.modify : EmptyAnimatableData | |
| (extension in :Animatable< where A.AnimatableData == EmptyAnimatableData>.animatableData.setter : EmptyAnimatableData | |
| (extension in :Animatable< where A: VectorArithmetic>.animatableData.getter : A | |
| (extension in :Animatable< where A: VectorArithmetic>.animatableData.modify : A | |
| (extension in :Animatable< where A: VectorArithmetic>.animatableData.setter : A | |
| (extension in :Button< where A == PrimitiveButtonStyleConfiguration.Label>.init(PrimitiveButtonStyleConfiguration) -> Button<PrimitiveButtonStyleConfiguration.Label> | |
| (extension in :Button< where A == Text>.init(_: LocalizedStringKey, action: () -> ()) -> Button<Text> | |
| (extension in :Button< where A == Text>.init<A where A1: StringProtocol>(_: A1, action: () -> ()) -> Button<Text> | |
| (extension in :CoreGraphics.CGFloat.magnitudeSqu |
| extension Binding { | |
| /// Wrapper to listen to didSet of Binding | |
| func didSet(_ didSet: @escaping ((newValue: Value, oldValue: Value)) -> Void) -> Binding<Value> { | |
| return .init(get: { self.wrappedValue }, set: { newValue in | |
| let oldValue = self.wrappedValue | |
| self.wrappedValue = newValue | |
| didSet((newValue, oldValue)) | |
| }) | |
| } | |
| import SwiftUI | |
| import UIKit | |
| struct PageViewController: UIViewControllerRepresentable { | |
| var controllers: [UIViewController] | |
| @Binding var currentPage: Int | |
| func makeCoordinator() -> Coordinator { | |
| Coordinator(self) | |
| } |
| // The SwiftUI Lab | |
| // Website: https://swiftui-lab.com | |
| // Article: https://swiftui-lab.com/alignment-guides | |
| import SwiftUI | |
| class Model: ObservableObject { | |
| @Published var minimumContainer = true | |
| @Published var extendedTouchBar = false | |
| @Published var twoPhases = true |
| import UIKit | |
| extension UIViewController { | |
| class var rootTabBarController: TabBarController? { | |
| guard let keyWindow = UIApplication.shared.keyWindow else { return nil } | |
| return keyWindow.rootViewController as? TabBarController | |
| } | |
| class var topMost: UIViewController? { |