-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
217 additions
and
14 deletions.
There are no files selected for viewing
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
40 changes: 40 additions & 0 deletions
40
LivePhotoToVideo/Modules/Photos/PhotoCollectionViewCell.swift
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// | ||
// PhotoCollectionViewCell.swift | ||
// UI | ||
// | ||
// Created by Alex Agapov on 23/03/2019. | ||
// Copyright © 2019 agapovco. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
import Reusable | ||
import Cartography | ||
|
||
class PhotoCollectionViewCell: UICollectionViewCell, Reusable { | ||
|
||
private let imageView = UIImageView() | ||
|
||
init() { | ||
super.init(frame: .zero) | ||
setup() | ||
} | ||
|
||
required init?(coder aDecoder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
private func setup() { | ||
addSubview(imageView) | ||
|
||
constrain(imageView) { i in | ||
i.edges == i.superview!.edges | ||
} | ||
} | ||
|
||
var image: UIImage? { | ||
didSet { | ||
imageView.image = image | ||
} | ||
} | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
LivePhotoToVideo/Modules/Photos/PhotoCollectionViewCell.xib
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13142" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> | ||
<dependencies> | ||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12042"/> | ||
<capability name="Safe area layout guides" minToolsVersion="9.0"/> | ||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> | ||
</dependencies> | ||
<objects> | ||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> | ||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> | ||
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="gTV-IL-0wX" customClass="PhotoCollectionViewCell" customModuleProvider="target"> | ||
<rect key="frame" x="0.0" y="0.0" width="50" height="50"/> | ||
<autoresizingMask key="autoresizingMask"/> | ||
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> | ||
<rect key="frame" x="0.0" y="0.0" width="50" height="50"/> | ||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/> | ||
</view> | ||
<viewLayoutGuide key="safeArea" id="ZTg-uK-7eu"/> | ||
</collectionViewCell> | ||
</objects> | ||
</document> |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// | ||
// Button+Styles.swift | ||
// UI | ||
// | ||
// Created by Alex Agapov on 23/03/2019. | ||
// Copyright © 2019 agapovco. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
extension UIButton { | ||
enum UI { | ||
static func big(title: String, color: UIColor) -> UIButton { | ||
let button = UIButton(type: .custom) | ||
|
||
button.backgroundColor = color | ||
button.layer.cornerRadius = 12 | ||
|
||
let font = UIFont.systemFont(ofSize: 20, weight: .light) | ||
|
||
let normalTitle = NSAttributedString(string: title, | ||
attributes: [.font: font, | ||
.foregroundColor: UIColor.white]) | ||
button.setAttributedTitle(normalTitle, for: .normal) | ||
|
||
let highlightedTitle = NSAttributedString(string: title, | ||
attributes: [.font: font, | ||
.foregroundColor: UIColor.white.withAlphaComponent(0.75)]) | ||
button.setAttributedTitle(highlightedTitle, for: .highlighted) | ||
return button | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// | ||
// Label+Styles.swift | ||
// LivePhotoToVideo | ||
// | ||
// Created by Alex Agapov on 23/03/2019. | ||
// Copyright © 2019 agapovco. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
extension UILabel { | ||
enum UI { | ||
static var headline: UILabel { | ||
let label = UILabel() | ||
let font = UIFont.systemFont(ofSize: 50, weight: .black) | ||
|
||
if #available(iOS 11.0, *) { | ||
label.font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: font) | ||
} else { | ||
label.font = font | ||
} | ||
label.textColor = UIColor(white: 0.1, alpha: 1) | ||
label.numberOfLines = 0 | ||
return label | ||
} | ||
|
||
static var body: UILabel { | ||
let label = UILabel() | ||
let font = UIFont.systemFont(ofSize: 20, weight: .semibold) | ||
|
||
if #available(iOS 11.0, *) { | ||
label.font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: font) | ||
} else { | ||
label.font = font | ||
} | ||
label.textColor = UIColor(white: 0.25, alpha: 1) | ||
label.numberOfLines = 0 | ||
return label | ||
} | ||
} | ||
} |