Giter VIP home page Giter VIP logo

swinganimation's Introduction

SwingAnimation

SPM CI

SwingAnimation is a framework allows you to apply smooth animations in widgets.

Example

Demo

content
    .swingAnimation(duration: 4, direction: .horizontal, distance: 280)
    .swingAnimation(duration: 1, direction: .vertical, distance: 60)

Requirements

  • iOS 14.0+
  • Swift 5.8+

Installation

Swift Package Manager

dependencies: [
    .package(url: "https://github.com/TopWidgets/SwingAnimation.git", .upToNextMajor(from: "1.0.0"))
]

Try our App

Star History

Star History Chart

License

SwingAnimation is available under the MIT license. See the LICENSE file for more info.

swinganimation's People

Contributors

octree avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

swinganimation's Issues

起始位置是乱的

组件被移除再添加时,动画的初始位置没有被重置,起始位置是乱的

使用过程中找不到 ClockHandRotationKit

我在使用过程中遇到两个问题:

  1. 使用 SPM 集成的情况下,我发现我必须在宿主 App 的 Link Binary with Libraries 中添加 SwingAnimation,否则,在运行小组件的时候,会提示找不到 ClockHandRotationKit:
dyld[18266]: Library not loaded: @rpath/ClockHandRotationKit.framework/ClockHandRotationKit
  Referenced from: /private/var/containers/Bundle/Application/ED21F8A4-CCBE-429D-9019-70193AF27BF0/MyHostApp.app/PlugIns/MyWidgetExtension.appex/MyWidgetExtension
  Reason: tried: '/usr/lib/swift/ClockHandRotationKit.framework/ClockHandRotationKit' (no such file), 

'/private/var/containers/Bundle/Application/ED21F8A4-CCBE-429D-9019-70193AF27BF0/MyHostApp.app/PlugIns/MyWidgetExtension.appex/Frameworks/ClockHandRotationKit.framework/ClockHandRotationKit' (no such file),
 '/private/var/containers/Bundle/Application/ED21F8A4-CCBE-429D-9019-70193AF27BF0/MyHostApp.app/PlugIns/MyWidgetExtension.appex/../../Frameworks/ClockHandRotationKit.framework/ClockHandRotationKit' (no such file),
 '/usr/lib/swift/ClockHandRotationKit.framework/ClockHandRotationKit' (no such file), 

'/private/var/containers/Bundle/Application/ED21F8A4-CCBE-429D-9019-70193AF27BF0/MyHostApp.app/PlugIns/MyWidgetExtension.appex/Frameworks/ClockHandRotationKit.framework/ClockHandRotationKit' (no such file), 
'/private/var/containers/Bundle/Application/ED21F8A4-CCBE-429D-9019-70193AF27BF0/MyHostApp.app/PlugIns/MyWidgetExtension.appex/../../Frameworks/ClockHandRotationKit.framework/ClockHandRotationKit' (no such file),
 '/System/Library/Frameworks/ClockHandRotationKit.framework/ClockHandRotationKit' (no such file)

但是,如果我在宿主 App 中添加了这个的话,由于我们的 App 需要支持iOS 12和iOS 13,在这些设备上运行就会crash:

dyld: warning: could not load inserted library '/System/Library/PrivateFrameworks/GPUToolsCapture.framework/GPUToolsCapture' into hardened process because image not found
dyld: Library not loaded: /System/Library/Frameworks/WidgetKit.framework/WidgetKit
  Referenced from: /private/var/containers/Bundle/Application/7A3242AE-A045-4377-BC7D-9875D932ACBB/WDBuyerUniv.app/Frameworks/ClockHandRotationKit.framework/ClockHandRotationKit
  Reason: image not found

此外,由于众所周知的原因,SPM 的包经常拉不下来,于是,我就将它制作成 pod:

Pod::Spec.new do |s|
  s.name             = 'MySwingAnimation'
  s.version          = '0.1.0'
  s.summary          = 'A short description of MySwingAnimation.'

  s.description      = <<-DESC
TODO: Add long description of the pod here.
                       DESC

  s.homepage         = 'https://gitlab.xxxx.net/xxx/MySwingAnimation'
  s.license          = { :type => 'MIT', :file => 'LICENSE' }
  s.author           = { 'xxx' => '[email protected]' }
  s.source           = { :git => 'ssh://[email protected]/xxx//MySwingAnimation.git', :tag => s.version.to_s }

  s.ios.deployment_target = '12.0'

  s.source_files = 'MySwingAnimation/Classes/**/*'
  s.swift_versions = ['5.1', '5.2', '5.3', '5.4', '5.5','5.9']

  s.vendored_frameworks = 'Frameworks/ClockHandRotationKit.xcframework'
  
  s.xcconfig = { 'EXCLUDED_ARCHS' => 'armv7','BUILD_LIBRARY_FOR_DISTRIBUTION' => 'YES' }
  s.attributes_hash['extended'] ||= {'cocoapods-binary-source-swithcer' => '~> 1.0.0', "is_xcframework" => "true"}
end

打包成 XCFramewwork 之后,针对小组件引入依赖 MySwingAnimation , 运行时还是出现了类似的错误:

dyld[18355]: Library not loaded: @rpath/ClockHandRotationKit.framework/ClockHandRotationKit
  Referenced from: /private/var/containers/Bundle/Application/429403CF-8F9D-4CE4-B98D-4D856A5692D2/MyHostApp.app/PlugIns/MyWidgetExtension.appex/MyWidgetExtension
  Reason: tried: '/usr/lib/swift/ClockHandRotationKit.framework/ClockHandRotationKit' (no such file), 
  '/private/var/containers/Bundle/Application/429403CF-8F9D-4CE4-B98D-4D856A5692D2/MyHostApp.app/PlugIns/MyWidgetExtension.appex/Frameworks/ClockHandRotationKit.framework/ClockHandRotationKit' (no such file),
   '/private/var/containers/Bundle/Application/429403CF-8F9D-4CE4-B98D-4D856A5692D2/MyHostApp.app/PlugIns/MyWidgetExtension.appex/../../Frameworks/ClockHandRotationKit.framework/ClockHandRotationKit' (no such file),
    '/usr/lib/swift/ClockHandRotationKit.framework/ClockHandRotationKit' (no such file),
     '/private/var/containers/Bundle/Application/429403CF-8F9D-4CE4-B98D-4D856A5692D2/MyHostApp.app/PlugIns/MyWidgetExtension.appex/Frameworks/ClockHandRotationKit.framework/ClockHandRotationKit' (no such file), 
  '/private/var/containers/Bundle/Application/429403CF-8F9D-4CE4-B98D-4D856A5692D2/MyHostApp.app/PlugIns/MyWidgetExtension.appex/../../Frameworks/ClockHandRotationKit.framework/ClockHandRotationKit' (no such file), 
  '/System/Library/Frameworks/ClockHandRotationKit.framework/ClockHandRotationKit' (no such file)

添加平移动画的内容会被裁剪

如果平移内容上增加了 .blur 修改,且内容有部份在小组件外,在iOS17以上系统,内容会被裁剪。然后在动画渲染之时,会有一个奇怪的过度:没被裁剪的部份会旋转到一个角度后再显示完整内容。即使给内容增加 .contentTransition(.identity) 的修改也会这样。

作者有遇到这个问题吗?有好的解决方案没?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.