Initial commit

This commit is contained in:
Selim Mustafaev 2023-07-28 00:55:16 +03:00
commit 03999cb555
20 changed files with 866 additions and 0 deletions

9
.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
.DS_Store
/.build
/Packages
/*.xcodeproj
xcuserdata/
DerivedData/
.swiftpm/config/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

16
Package.swift Normal file
View File

@ -0,0 +1,16 @@
// swift-tools-version: 5.8
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "YadUI",
products: [
.library(name: "YadUI", targets: ["YadUI"]),
],
dependencies: [
],
targets: [
.target(name: "YadUI", dependencies: [])
]
)

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# YadUI
Yet another declarative UI

View File

@ -0,0 +1,20 @@
//
// UIEdgeInsets.swift
//
//
// Created by Мустафаев Селим Мустафаевич on 27.07.2023.
//
import UIKit
extension UIEdgeInsets {
public init(all: CGFloat) {
self.init(top: all, left: all, bottom: all, right: all)
}
public init(vertical: CGFloat = 0, horizontal: CGFloat = 0) {
self.init(top: vertical, left: horizontal, bottom: vertical, right: horizontal)
}
}

View File

@ -0,0 +1,40 @@
//
// UIView.swift
//
//
// Created by Мустафаев Селим Мустафаевич on 27.07.2023.
//
import UIKit
extension UIView {
public func withoutAutoresizing() -> Self {
translatesAutoresizingMaskIntoConstraints = false
return self
}
public func pin(to view: UIView, insets: UIEdgeInsets = .zero) {
NSLayoutConstraint.activate([
leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: insets.left),
trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -insets.right),
topAnchor.constraint(equalTo: view.topAnchor, constant: insets.top),
bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: -insets.bottom)
])
}
public func width(_ width: CGFloat) -> Self {
widthAnchor.constraint(equalToConstant: width).isActive = true
return self
}
public func height(_ height: CGFloat) -> Self {
heightAnchor.constraint(equalToConstant: height).isActive = true
return self
}
public func background(_ color: UIColor) -> Self {
backgroundColor = color
return self
}
}

View File

@ -0,0 +1,115 @@
//
// VStack.swift
//
//
// Created by Мустафаев Селим Мустафаевич on 27.07.2023.
//
import UIKit
public enum StackAlignment {
case fill
}
public enum StackDistribution {
case fill
}
public enum StackAxis {
case horizontal
case vertical
}
public final class VStack: UIView {
private var arrangedSubviews: [UIView]
private var alignment: StackAlignment
private var distribution: StackDistribution
private var axis: StackAxis
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
public init(axis: StackAxis = .vertical,
alignment: StackAlignment = .fill,
distribution: StackDistribution = .fill,
@StackViewBuilder _ content: () -> [UIView]) {
self.axis = axis
self.alignment = alignment
self.distribution = distribution
self.arrangedSubviews = content()
super.init(frame: .zero)
self.arrangedSubviews.forEach(addSubview)
NSLayoutConstraint.activate(generateAlignmentConstraints())
NSLayoutConstraint.activate(generateDistributionConstraints())
}
func generateAlignmentConstraints() -> [NSLayoutConstraint] {
switch alignment {
case .fill:
return generateAlignmentFillConstraints()
}
}
func generateDistributionConstraints() -> [NSLayoutConstraint] {
switch distribution {
case .fill:
return generateDistributionFillConstraints()
}
}
func generateAlignmentFillConstraints() -> [NSLayoutConstraint] {
guard let firstView = arrangedSubviews.first else {
return []
}
let otherViews = arrangedSubviews.dropFirst()
var constraints: [NSLayoutConstraint] = [
firstView.leadingAnchor.constraint(equalTo: leadingAnchor),
firstView.trailingAnchor.constraint(equalTo: trailingAnchor)
]
for view in otherViews {
constraints.append(contentsOf: [
view.leadingAnchor.constraint(equalTo: firstView.leadingAnchor),
view.trailingAnchor.constraint(equalTo: firstView.trailingAnchor)
])
}
return constraints
}
func generateDistributionFillConstraints() -> [NSLayoutConstraint] {
guard let firstView = arrangedSubviews.first,
let lastView = arrangedSubviews.last
else {
return []
}
let middleViews = arrangedSubviews.dropFirst().dropLast()
var constraints: [NSLayoutConstraint] = [
firstView.topAnchor.constraint(equalTo: topAnchor),
lastView.bottomAnchor.constraint(equalTo: bottomAnchor)
]
var currentView = firstView
for view in middleViews {
constraints.append(view.topAnchor.constraint(equalTo: currentView.bottomAnchor))
currentView = view
}
constraints.append(lastView.topAnchor.constraint(equalTo: currentView.bottomAnchor))
return constraints
}
}

18
Sources/YadUI/YadUI.swift Normal file
View File

@ -0,0 +1,18 @@
import UIKit
@resultBuilder
public struct RootViewBuilder {
public static func buildBlock(_ components: UIView...) -> UIView {
let view = components.first ?? UIView()
return view.withoutAutoresizing()
}
}
@resultBuilder
public struct StackViewBuilder {
public static func buildBlock(_ components: UIView...) -> [UIView] {
components.map { $0.withoutAutoresizing() }
}
}

View File

@ -0,0 +1,395 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 56;
objects = {
/* Begin PBXBuildFile section */
63D50C192A72425E009E853A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63D50C182A72425E009E853A /* AppDelegate.swift */; };
63D50C1B2A72425E009E853A /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63D50C1A2A72425E009E853A /* SceneDelegate.swift */; };
63D50C1D2A72425E009E853A /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63D50C1C2A72425E009E853A /* ViewController.swift */; };
63D50C202A72425E009E853A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 63D50C1E2A72425E009E853A /* Main.storyboard */; };
63D50C222A72425F009E853A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 63D50C212A72425F009E853A /* Assets.xcassets */; };
63D50C252A72425F009E853A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 63D50C232A72425F009E853A /* LaunchScreen.storyboard */; };
63D50C302A7242F3009E853A /* YadUI in Frameworks */ = {isa = PBXBuildFile; productRef = 63D50C2F2A7242F3009E853A /* YadUI */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
63D50C152A72425E009E853A /* YadUIDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = YadUIDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
63D50C182A72425E009E853A /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
63D50C1A2A72425E009E853A /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
63D50C1C2A72425E009E853A /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
63D50C1F2A72425E009E853A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
63D50C212A72425F009E853A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
63D50C242A72425F009E853A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
63D50C262A72425F009E853A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
63D50C2D2A7242DA009E853A /* YadUI */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = YadUI; path = ..; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
63D50C122A72425D009E853A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
63D50C302A7242F3009E853A /* YadUI in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
63D50C0C2A72425D009E853A = {
isa = PBXGroup;
children = (
63D50C2C2A7242DA009E853A /* Packages */,
63D50C172A72425E009E853A /* YadUIDemo */,
63D50C162A72425E009E853A /* Products */,
63D50C2E2A7242F3009E853A /* Frameworks */,
);
sourceTree = "<group>";
};
63D50C162A72425E009E853A /* Products */ = {
isa = PBXGroup;
children = (
63D50C152A72425E009E853A /* YadUIDemo.app */,
);
name = Products;
sourceTree = "<group>";
};
63D50C172A72425E009E853A /* YadUIDemo */ = {
isa = PBXGroup;
children = (
63D50C182A72425E009E853A /* AppDelegate.swift */,
63D50C1A2A72425E009E853A /* SceneDelegate.swift */,
63D50C1C2A72425E009E853A /* ViewController.swift */,
63D50C1E2A72425E009E853A /* Main.storyboard */,
63D50C212A72425F009E853A /* Assets.xcassets */,
63D50C232A72425F009E853A /* LaunchScreen.storyboard */,
63D50C262A72425F009E853A /* Info.plist */,
);
path = YadUIDemo;
sourceTree = "<group>";
};
63D50C2C2A7242DA009E853A /* Packages */ = {
isa = PBXGroup;
children = (
63D50C2D2A7242DA009E853A /* YadUI */,
);
name = Packages;
sourceTree = "<group>";
};
63D50C2E2A7242F3009E853A /* Frameworks */ = {
isa = PBXGroup;
children = (
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
63D50C142A72425D009E853A /* YadUIDemo */ = {
isa = PBXNativeTarget;
buildConfigurationList = 63D50C292A72425F009E853A /* Build configuration list for PBXNativeTarget "YadUIDemo" */;
buildPhases = (
63D50C112A72425D009E853A /* Sources */,
63D50C122A72425D009E853A /* Frameworks */,
63D50C132A72425D009E853A /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = YadUIDemo;
packageProductDependencies = (
63D50C2F2A7242F3009E853A /* YadUI */,
);
productName = YadUIDemo;
productReference = 63D50C152A72425E009E853A /* YadUIDemo.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
63D50C0D2A72425D009E853A /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1430;
LastUpgradeCheck = 1430;
TargetAttributes = {
63D50C142A72425D009E853A = {
CreatedOnToolsVersion = 14.3.1;
};
};
};
buildConfigurationList = 63D50C102A72425D009E853A /* Build configuration list for PBXProject "YadUIDemo" */;
compatibilityVersion = "Xcode 14.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 63D50C0C2A72425D009E853A;
productRefGroup = 63D50C162A72425E009E853A /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
63D50C142A72425D009E853A /* YadUIDemo */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
63D50C132A72425D009E853A /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
63D50C252A72425F009E853A /* LaunchScreen.storyboard in Resources */,
63D50C222A72425F009E853A /* Assets.xcassets in Resources */,
63D50C202A72425E009E853A /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
63D50C112A72425D009E853A /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
63D50C1D2A72425E009E853A /* ViewController.swift in Sources */,
63D50C192A72425E009E853A /* AppDelegate.swift in Sources */,
63D50C1B2A72425E009E853A /* SceneDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
63D50C1E2A72425E009E853A /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
63D50C1F2A72425E009E853A /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
63D50C232A72425F009E853A /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
63D50C242A72425F009E853A /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
63D50C272A72425F009E853A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
63D50C282A72425F009E853A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
63D50C2A2A72425F009E853A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 46DTTB8X4S;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = YadUIDemo/Info.plist;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
INFOPLIST_KEY_UIMainStoryboardFile = Main;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = pro.aliencat.YadUIDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
63D50C2B2A72425F009E853A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 46DTTB8X4S;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = YadUIDemo/Info.plist;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
INFOPLIST_KEY_UIMainStoryboardFile = Main;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = pro.aliencat.YadUIDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
63D50C102A72425D009E853A /* Build configuration list for PBXProject "YadUIDemo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
63D50C272A72425F009E853A /* Debug */,
63D50C282A72425F009E853A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
63D50C292A72425F009E853A /* Build configuration list for PBXNativeTarget "YadUIDemo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
63D50C2A2A72425F009E853A /* Debug */,
63D50C2B2A72425F009E853A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
/* Begin XCSwiftPackageProductDependency section */
63D50C2F2A7242F3009E853A /* YadUI */ = {
isa = XCSwiftPackageProductDependency;
productName = YadUI;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 63D50C0D2A72425D009E853A /* Project object */;
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@ -0,0 +1,36 @@
//
// AppDelegate.swift
// YadUIDemo
//
// Created by Мустафаев Селим Мустафаевич on 27.07.2023.
//
import UIKit
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}

View File

@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,13 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
</dict>
</array>
</dict>
</dict>
</dict>
</plist>

View File

@ -0,0 +1,52 @@
//
// SceneDelegate.swift
// YadUIDemo
//
// Created by Мустафаев Селим Мустафаевич on 27.07.2023.
//
import UIKit
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let _ = (scene as? UIWindowScene) else { return }
}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}
}

View File

@ -0,0 +1,35 @@
//
// ViewController.swift
// YadUIDemo
//
// Created by Мустафаев Селим Мустафаевич on 27.07.2023.
//
import UIKit
import YadUI
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let child = buildView()
view.addSubview(child)
child.pin(to: view)
}
@RootViewBuilder func buildView() -> UIView {
VStack {
UIView()
.background(.red)
.height(100)
UIView()
.background(.green)
.height(100)
UIView()
.background(.blue)
//.height(100)
}
}
}