This file has been truncated, but you can view the full file.
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
// swift-interface-format-version: 1.0 | |
// swift-compiler-version: Apple Swift version 5.7 (swiftlang-5.7.0.113.10 clang-1400.0.16.2) | |
// swift-module-flags: -target arm64-apple-ios16.0 -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -Osize -library-level api -library-level api -module-name SwiftUI | |
// swift-module-flags-ignorable: -user-module-version 4.0.66.3.102 | |
import Accessibility | |
import Combine | |
import CoreData | |
import CoreFoundation | |
@_exported import CoreGraphics | |
@_exported import CoreTransferable |
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 Combine | |
struct ContentView: View { | |
var body: some View { | |
VStack { | |
Section { | |
list | |
.frame(height: 150) | |
} header: { |
This file has been truncated, but you can view the full file.
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
// swift-interface-format-version: 1.0 | |
// swift-compiler-version: Apple Swift version 5.6 (swiftlang-5.6.0.323.35 clang-1316.0.20.9) | |
// swift-module-flags: -target arm64-apple-ios15.5 -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -Osize -library-level api -library-level api -module-name SwiftUI | |
// swift-module-flags-ignorable: -user-module-version 3.5.2 | |
import Accessibility | |
import Combine | |
import CoreData | |
import CoreFoundation | |
import CoreGraphics | |
import Darwin |
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 { | |
var value: Int = 0 | |
var body: some View { | |
Text("Hello") | |
.padding() | |
.background(.orange) | |
.clipShape(shape) |
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
let marginTop = NSLayoutConstraint(item: box, attribute: .top, relatedBy: .equal, toItem: view, attribute: .top, multiplier: 1.0, constant: 50) | |
let marginLeft = NSLayoutConstraint(item: box, attribute: .left, relatedBy: .equal, toItem: view, attribute: .left, multiplier: 1.0, constant: 20) | |
let marginRight = NSLayoutConstraint(item: box, attribute: .right, relatedBy: .equal, toItem: view, attribute: .right, multiplier: 1.0, constant: -20) | |
let height = NSLayoutConstraint(item: box, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1.0, constant: 100) | |
NSLayoutConstraint.activate([marginTop, marginLeft, marginRight, height]) |
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
let views = ["box" : box] | |
let horizontal = "H:|-20-[box]-20-|" | |
let vertical = "V:|-50-[box(100)]" | |
let horizontalConstraints = NSLayoutConstraint.constraints(withVisualFormat: horioptions: [], metrics: nil, views: views) | |
let verticalConstraints = NSLayoutConstraint.constraints(withVisualFormat: veoptions: [], metrics: nil, views: views) | |
NSLayoutConstraint.activate([horizontalConstraints, verticalConstraints].flatMap({ $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
public extension Anchor { | |
/// Find a constraint based on an attribute | |
func find(_ attribute: Attribute) -> NSLayoutConstraint? { | |
guard let view = item as? View else { | |
return nil | |
} | |
var constraints = view.superview?.constraints | |
if attribute == .width || attribute == .height { | |
constraints?.append(contentsOf: view.constraints) | |
} |
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
enum To { | |
case anchor(Anchor) | |
case size | |
case none | |
} | |
class Pin { | |
let attribute: Attribute | |
var constant: CGFloa | |
init(_ attribute: Attribute, constant: CGFloat = 0) { | |
self.attribute = attribute |
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
public extension UIView { | |
func pinCenter(view: UIView) -> [NSLayoutConstraint] { | |
return [ | |
centerXAnchor.constraint(equalTo: view.centerXAnchor), | |
centerYAnchor.constraint(equalTo: view.centerYAnchor) | |
] | |
} | |
func pin(size: CGSize) -> [NSLayoutConstraint] { | |
return [ |
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
public extension NSLayoutConstraint { | |
/// Disable auto resizing mask and activate constraints | |
/// | |
/// - Parameter constraints: constraints to activate | |
static func on(_ constraints: [NSLayoutConstraint]) { | |
constraints.forEach { | |
($0.firstItem as? UIView)?.translatesAutoresizingMaskIntoConstraints = false | |
$0.isActive = true | |
} |
NewerOlder