├── README.md ├── LICENSE └── Xcode13ClockHandRotationEffectModifier.swift /README.md: -------------------------------------------------------------------------------- 1 | # Xcode13ClockHandRotationEffectModifier 2 | 3 | 4 | Make sure Xcode13 is default. 5 | 6 | ``` 7 | xcode-select -p 8 | /Applications/Xcode13.4.1.app/Contents/Developer 9 | ``` 10 | 11 | Otherwise 12 | 13 | ``` 14 | sudo xcode-select -s /Applications/Xcode13.4.1.app 15 | ``` 16 | 17 | 18 | Create xcframework 19 | 20 | 1. create a swift framework project named : Xcode13ClockHandRotationEffect 21 | 2. add Xcode13ClockHandRotationEffectModifier.swift to the project 22 | 3. run build-xcframework.sh in the project root. 23 | 4. use the xcframework for SPM or directly into your Xcode14 project 24 | 25 | 26 | Or build single file 27 | 28 | ```bash 29 | xcrun swiftc Xcode13ClockHandRotationEffectModifier.swift -emit-module -emit-library -static 30 | ``` 31 | 32 | 33 | Then make it spm. 34 | 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 everettjf 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Xcode13ClockHandRotationEffectModifier.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Xcode13ClockHandRotationEffectModifier.swift 3 | // Xcode13ClockHandRotationEffectModifier 4 | // 5 | // Created by everettjf on 2022/12/14. 6 | // 7 | import SwiftUI 8 | import WidgetKit 9 | 10 | 11 | pubilc enum Xcode13ClockHandRotationEffectPeriod { 12 | case custom(TimeInterval) 13 | case secondHand, hourHand, miniuteHand 14 | } 15 | 16 | pubilc struct Xcode13ClockHandRotationEffectModifier: ViewModifier { 17 | 18 | let clockPeriod: WidgetKit._ClockHandRotationEffect.Period 19 | let clockTimezone: TimeZone 20 | let clockAnchor: UnitPoint 21 | 22 | pubilc init(period: Xcode13ClockHandRotationEffectPeriod, timezone: TimeZone, anchor: UnitPoint) { 23 | var clockPeriod: WidgetKit._ClockHandRotationEffect.Period = .secondHand 24 | switch period { 25 | case .custom(let timeInterval): 26 | clockPeriod = .custom(timeInterval) 27 | case .secondHand: 28 | clockPeriod = .secondHand 29 | case .hourHand: 30 | clockPeriod = .hourHand 31 | case .miniuteHand: 32 | clockPeriod = .minuteHand 33 | } 34 | self.clockPeriod = clockPeriod 35 | self.clockTimezone = timezone 36 | self.clockAnchor = anchor 37 | } 38 | 39 | pubilc func body(content: Content) -> some View { 40 | content 41 | ._clockHandRotationEffect(self.clockPeriod, in: self.clockTimezone, anchor: self.clockAnchor) 42 | } 43 | 44 | } 45 | --------------------------------------------------------------------------------