This file contains hidden or 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
class ViewController: UIViewController, UIScrollViewDelegate { | |
let scrollView = UIScrollView() | |
// let scroll = UIView() | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
view = scrollView |
This file contains hidden or 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 frame = CGRect(x: 0, y: 50, width: 50, height: 50) | |
let blueSquare = UIView(frame: frame) | |
blueSquare.backgroundColor = .systemRed | |
view.addSubview(blueSquare) | |
let startOfWidth = Int(view.bounds.minX) | |
let endOfwidth = Int(view.bounds.maxX) | |
let startOfHeight = Int(view.bounds.minY) | |
let endOfHeight = Int(view.bounds.maxY) |
This file contains hidden or 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
var scrollViewVertical = UIScrollView() // внимание | |
var firstView = UIView() | |
let lable = UILabel() | |
var scrollViewVerticalFrame: UIView // и тут | |
func squareVertical(_ count: Int) { |
This file contains hidden or 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
for i in 0..<count{ | |
let sq = UIView() | |
let x = sq.frame.maxX | |
let color: [UIColor] = [.systemRed, | |
.systemYellow, | |
.systemBlue, | |
.systemGray, | |
.systemPink, | |
.systemGray2] | |
This file contains hidden or 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
var colotOfFirstView = UIColor() | |
if firstView.bounds == lable.bounds | |
{ | |
colotOfFirstView = .systemRed | |
} else { | |
colotOfFirstView = .systemYellow | |
} | |
firstView.backgroundColor = colotOfFirstView | |
lable.backgroundColor = .systemRed |
This file contains hidden or 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
func hackerSpeak(_ str: String) -> String { | |
var stt = [Character]() | |
var result = [Character]() | |
for Character in str{ | |
stt.append(Character) | |
} | |
This file contains hidden or 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
func filterStateNames(_ arr: [String], _ type: String) -> [String] { | |
if type != "abb" { | |
return arr.filter({$0.count > 2}) | |
} | |
if type != "full" { | |
return arr.filter({$0.count < 2}) |
This file contains hidden or 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
func isStrangePair(_ str1: String, _ str2: String) -> Bool { | |
if str1.index(after: str1.startIndex) == str2.index(before: str2.endIndex) | |
&& | |
str1.index(before: str1.endIndex) == str2.index(after: str2.startIndex) | |
{ | |
return true |
This file contains hidden or 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
lass myViewController: UIViewController{ | |
@IBOutlet weak var viewForLayer: UIView! | |
var layer: CALayer { | |
return viewForLayer.layer | |
} | |
func setUpLayer() { |
This file contains hidden or 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
func bullet1( count: Int) -> [CALayer]{ | |
let bul = [CALayer]() | |
// let distance = 10 | |
for i in 0...count { | |
let layer = CALayer() | |
layer.backgroundColor = CGColor(srgbRed: 0.8, green: 0.2, blue: 0.8, alpha: 1.0) | |
layer.frame = CGRect(x: 250 , | |
y: 150 + (i * count), |
NewerOlder