Skip to content

Commit

Permalink
Merge branch 'test'
Browse files Browse the repository at this point in the history
  • Loading branch information
kean committed Jul 13, 2022
2 parents ed0a7e3 + e63237b commit f4ac7f8
Show file tree
Hide file tree
Showing 57 changed files with 769 additions and 876 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: "Align CI"

on:
push:
branches:
- master
pull_request:
branches:
- '*'

jobs:
macos-run-tests:
name: Unit Tests (macOS, Xcode 13.3.1)
runs-on: macOS-12
env:
DEVELOPER_DIR: /Applications/Xcode_13.3.1.app/Contents/Developer
steps:
- uses: actions/checkout@v2
- name: Run Tests
run: swift test

ios-run-tests:
name: Unit Tests (iOS 15.4, Xcode 13.3.1)
runs-on: macOS-12
env:
DEVELOPER_DIR: /Applications/Xcode_13.3.1.app/Contents/Developer
steps:
- uses: actions/checkout@v2
- name: Run Tests
run: xcodebuild test -scheme "Align" -destination "OS=15.4,name=iPhone 13 Pro"

discover-typos:
name: Discover Typos
runs-on: macOS-12
env:
DEVELOPER_DIR: /Applications/Xcode_13.4.1.app/Contents/Developer
steps:
- uses: actions/checkout@v2
- name: Discover typos
run: |
python3 -m pip install --upgrade pip
python3 -m pip install codespell
codespell --ignore-words-list="inout"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
## Build generated
build/
DerivedData/
.swiftpm/

## Various settings
*.pbxuser
Expand Down
39 changes: 0 additions & 39 deletions .travis.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class MyViewController : UIViewController {

subview.anchors.edges.pin(
insets: EdgeInsets(top: 10, left: 10, bottom: 10, right: 10),
alignment: Alignmment(horizontal: .leading, vertical: .center)
alignment: Alignment(horizontal: .leading, vertical: .center)
)

view.addSubview(container)
Expand Down
55 changes: 25 additions & 30 deletions Align.playground/Pages/Demo.xcplaygroundpage/Contents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,26 @@ import UIKit
import PlaygroundSupport
import Align

typealias Stack = UIStackView

extension Stack {
@nonobjc convenience init(style: ((UIStackView) -> Void)..., views: [UIView]) {
self.init(arrangedSubviews: views)
style.forEach { $0(self) }
}
}

extension UILabel {
@nonobjc convenience init(style: ((UILabel) -> Void)...) {
self.init()
style.forEach { $0(self) }
}
}

class MyViewController : UIViewController {
override func viewDidLoad() {
super.viewDidLoad()

view.backgroundColor = UIColor.white

let logo = UILabel(style: { $0.font = UIFont.systemFont(ofSize: 30) })
let title = UILabel(style: { $0.font = UIFont.systemFont(ofSize: 20, weight: .bold) })
let subtitle = UILabel(style: {
$0.font = UIFont.systemFont(ofSize: 15)
$0.numberOfLines = 0
})

let stack = Stack(
style: { $0.spacing = 10; $0.alignment = .top },
views: [
logo,
Stack(style: { $0.axis = .vertical }, views: [title, subtitle])
]
)
let logo = UILabel()
logo.font = UIFont.systemFont(ofSize: 30)

let title = UILabel()
title.font = UIFont.systemFont(ofSize: 20, weight: .bold)

let subtitle = UILabel()
subtitle.font = UIFont.systemFont(ofSize: 15)
subtitle.numberOfLines = 0

let stack = UIStackView(spacing: 10, alignment: .top, [
logo,
UIStackView(axis: .vertical, [title, subtitle])
])
view.addSubview(stack)

/// Here's code written using Align
Expand All @@ -54,4 +37,16 @@ class MyViewController : UIViewController {
}
}

extension UIStackView {
@nonobjc convenience init(spacing: CGFloat = 10,
axis: NSLayoutConstraint.Axis = .horizontal,
alignment: UIStackView.Alignment = .fill,
_ views: [UIView]) {
self.init(arrangedSubviews: views)
self.spacing = spacing
self.axis = axis
self.alignment = alignment
}
}

PlaygroundPage.current.liveView = MyViewController()
19 changes: 0 additions & 19 deletions Align.podspec

This file was deleted.

Loading

0 comments on commit f4ac7f8

Please sign in to comment.