taler-ios

iOS apps for GNU Taler (wallet)
Log | Files | Refs | README | LICENSE

CGSize+Random.swift (1581B)


      1 //  MIT License
      2 //  Copyright © SwiftUI-Lab
      3 //  https://swiftui-lab.com/matchedGeometryEffect-part2
      4 //
      5 //  Permission is hereby granted, free of charge, to any person obtaining a copy of this software
      6 //  and associated documentation files (the "Software"), to deal in the Software without restriction,
      7 //  including without limitation the rights to use, copy, modify, merge, publish, distribute,
      8 //  sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
      9 //  furnished to do so, subject to the following conditions:
     10 //
     11 //  The above copyright notice and this permission notice shall be included in all copies or
     12 //  substantial portions of the Software.
     13 //
     14 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
     15 //  BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
     16 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
     17 //  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     18 //  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
     19 //
     20 
     21 import SwiftUI
     22 
     23 extension CGSize {
     24     static func random(width: ClosedRange<CGFloat>, height: ClosedRange<CGFloat>) -> CGSize {
     25         return CGSize(width: CGFloat.random(in: width), height: CGFloat.random(in: height))
     26     }
     27     
     28     static func random(in range: ClosedRange<CGFloat>) -> CGSize {
     29         return CGSize(width: CGFloat.random(in: range), height: CGFloat.random(in: range))
     30     }
     31 }