-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/slice_background_image' into develop
- Loading branch information
Showing
132 changed files
with
1,965 additions
and
332 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
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
35 changes: 35 additions & 0 deletions
35
Sources/SwiftFortuneWheel/Extensions/CGRect+AspectFill.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,35 @@ | ||
// | ||
// CGRect+AspectFill.swift | ||
// SwiftFortuneWheel | ||
// | ||
// Created by Sherzod Khashimov on 7/22/20. | ||
// Copyright © 2020 SwiftFortuneWheel. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
#if os(macOS) | ||
import AppKit | ||
#else | ||
import UIKit | ||
#endif | ||
|
||
extension CGSize { | ||
|
||
static func aspectFill(aspectRatio :CGSize, minimumSize: CGSize) -> CGSize { | ||
|
||
var minimumSize = minimumSize | ||
|
||
let mW = minimumSize.width / aspectRatio.width; | ||
let mH = minimumSize.height / aspectRatio.height; | ||
|
||
if( mH > mW ) { | ||
minimumSize.width = minimumSize.height / aspectRatio.height * aspectRatio.width; | ||
} | ||
else if( mW > mH ) { | ||
minimumSize.height = minimumSize.width / aspectRatio.width * aspectRatio.height; | ||
} | ||
|
||
return minimumSize; | ||
} | ||
} |
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
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
Oops, something went wrong.