35 Commits

Author SHA1 Message Date
Mario Zechner
3d5d64885b [ios] Update to latest spine-c, fix swift-writer.cpp to cast on the C++ side if necesary. 2025-09-11 00:28:45 +02:00
Mario Zechner
998fd7d17e [c][ios][flutter] Add render object getter setter to TextureRegion and AtlasRegion 2025-08-29 15:59:50 +02:00
Mario Zechner
51410a526e [c] Direct setListener on track entry and animation state 2025-08-29 15:10:56 +02:00
Mario Zechner
3d5a66b5f8 Formatting 2025-08-28 13:57:28 +02:00
Mario Zechner
ab53d271a4 feat(spine-ios): Add memory leak detection and fix PMA handling
- Enable debug extension on app startup for leak detection
- Add reportLeaks() calls when example views disappear
- Fix PMA flag handling by reading it from atlas page instead of hardcoding to false
- Add manual dispose() method to SpineController for explicit cleanup if needed

Note: SwiftUI view caching may show false positive leaks when views disappear,
as SwiftUI keeps views in memory for performance until they're truly no longer needed.
2025-08-27 11:21:23 +02:00
Mario Zechner
cb62bd70c0 feat(spine-ios): Add Objective-C support to generated Swift bindings
- Add NSObject inheritance to root classes for ObjC compatibility
- Add @objc(Spine<ClassName>) and @objcMembers annotations to all classes
- Fix property name conflicts (className -> rttiClassName, hash -> hashString)
- Use @nonobjc on subclass initializers to avoid selector conflicts
- Fix convenience init override modifiers
- Update ObjC example to use new API method names
- Update test to use rttiClassName property
2025-08-27 10:58:23 +02:00
Mario Zechner
81c9f5630a [ios] Fix SkeletonDrawableWrapper.update() to call directly into the drawable. 2025-08-26 17:38:08 +02:00
Mario Zechner
9b345068b6 feat(spine-ios): Update SpineiOS and Example to work with new SpineSwift generated bindings
- Remove AnimationStateWrapper (no longer needed with new SpineSwift API)
- Replace Spine.Generated+Extensions.swift with simplified SpineSwiftExtensions.swift
- Update SpineiOS to use SpineSwift API instead of direct SpineC calls
- Fix namespace conflicts (ContentMode → SpineContentMode, Alignment → SpineAlignment)
- Update texture mapping to use atlas page index from RenderCommand pointer
- Fix all Example app API calls to match new SpineSwift generated API:
  - setAnimationByName → setAnimation
  - addAnimationByName → addAnimation
  - slot.color → slot.appliedPose.color.set()
  - EventType enum cases instead of constants
  - Physics enum with qualified name to avoid conflicts
  - setSkin2() instead of property assignment
  - Array iteration using indices instead of for-in
  - bone.worldX → bone.appliedPose.worldX
- Update Objective-C imports from Spine to SpineiOS module

Note: SimpleAnimationViewController.m still needs updates for full ObjC compatibility
2025-08-26 17:35:31 +02:00
Mario Zechner
f1d98393d5 fix(spine-ios): Fix memory management and complete test implementation
- Changed code generator to emit dispose() methods instead of deinit
- Add override keyword for dispose() in subclasses
- Keep deinit with _ownsMemory check for array types
- Fix SkinExtensions to use correct C++ class names for attachments
- Complete skeleton_drawable_test implementations with no warnings
- Add comprehensive bone pose transformation tests
- Fix skin entries test to properly show attachments

The memory management fix prevents Swift wrappers from accidentally
disposing C++ objects they don't own when created via fromPointer.
2025-08-16 21:24:13 +02:00
Mario Zechner
cc43fd549b feat(spine-ios): Implement SpineSwift high-level API mirroring spine_dart.dart
- Created SkeletonDrawable class wrapping spine_skeleton_drawable C functions
- Implemented AnimationStateEventManager singleton for event listener management
- Added helper types: Bounds and Vector structs
- Added extensions for Skeleton (bounds, getPosition)
- Added extensions for Skin (getEntries to iterate attachments)
- Added extensions for BonePose (coordinate transformations)
- Added extensions for AnimationState and TrackEntry (event listeners)
- Created skeleton_drawable_test_swift.swift using SpineSwift high-level API
- Updated test Package.swift to include SpineSwift dependency
- SpineSwift module now compiles with 0 errors

This completes the port of the high-level API from spine-flutter's spine_dart.dart
to SpineSwift, providing a clean Swift API that mirrors the Dart implementation.
2025-08-11 20:17:17 +02:00
Mario Zechner
9fdc0f0033 spine-ios: Fix Swift bindings compilation - arrays and type conversions
- Fixed array wrapper generation to use correct pointer casting
- Changed array count/length properties to return Int instead of Int32
- Fixed buffer access for primitive and object arrays (no assumingMemoryBound needed)
- Corrected size_t parameters to use Int instead of Int32
- Updated module imports (SpineSwift instead of Spine)
- Reduced compilation errors from 17,500 to 0 for SpineSwift module
- Remaining 27 errors are iOS-specific (UIKit) in SpineiOS module
2025-08-11 19:31:33 +02:00
Mario Zechner
a52ac67661 [ios] More Swift generator work. 2025-08-11 19:11:24 +02:00
Mario Zechner
ecbd700af4 Restructure spine-ios modules: SpineC, SpineSwift, SpineiOS
- Created clean module separation:
  - SpineC: C/C++ compilation only (working)
  - SpineSwift: Generated Swift bindings + platform-agnostic API
  - SpineiOS: iOS-specific UI components only
- Updated Package.swift with proper target structure
- Moved generated Swift files to SpineSwift/Generated
- Removed redundant SpineModule
- Created test with skeleton_drawable_test.swift ported from Dart
- Test successfully runs using SpineC module directly
- Note: SpineSwift has Objective-C selector conflicts to be fixed
2025-08-11 19:07:29 +02:00
Mario Zechner
106c39d0af [workflows] Add diff artifact to dart format check for debugging 2025-07-31 21:32:13 +02:00
Mario Zechner
d409ff23ff Fix format-xx.sh files wrt logging, add proper Swift formatting configuration. 2025-07-20 21:31:07 +02:00
Mario Zechner
b544dd99ed [formatters] C/C++ formatting 2025-07-15 22:56:12 +02:00
Nathan Sweet
7be6dac44a Merge branch '4.2' into 4.3-beta
# Conflicts:
#	spine-ts/package.json
#	spine-unity/Assets/Spine/package.json
2025-05-09 17:05:41 -04:00
Byeong Gwan
123426d3e3
[iOS] fix additive, normal blending (#2822) 2025-05-05 11:57:51 +02:00
Nathan Sweet
dafafca942 Merge branch '4.2' into 4.3-beta-sliders
# Conflicts:
#	spine-ts/package.json
2025-04-23 11:59:55 -04:00
Byeong Gwan
759c8115c4
[iOS] Spine fix Metal deadlock (#2816) 2025-04-17 11:19:14 +02:00
Byeong Gwan
f04382bacd
expose multiplatform spine-engine target (#2806) 2025-04-10 11:28:34 +02:00
Byeong Gwan
88230582c2
[iOS] merge shader header and disable cpp-interp in example project (#2808)
* [iOS] disable objc-interp in example project & reuse struct header inside shader

* [iOS] support sharing Shader Header on both cocoapods and SPM
2025-04-10 11:27:24 +02:00
Mario Zechner
7cafab92b0
Update spine-cpp-lite.h 2025-04-09 12:18:02 +02:00
Byeong Gwan
6e5da45fa3
[iOS] update Swift inteface for more fine grained control(like external atlas loading) (#2772)
* update Swift inteface for more fine grained control

- move instance method to static method which does not require spine cpp pointer
- implement equality and hashing based on cpp pointer so that it can be stored in collection and compare it
- expose Atlas image count property so that the user can load the atlas resource lazily

- User can now Create Atlas by using Altas static function, and fetch whole resource path by iterating count of atlas page count

* [iOS] fix wrong y-axis alignment
2025-04-08 11:51:32 +02:00
Nathan Sweet
f08d58dc98 License header update. 2025-04-05 13:42:13 -04:00
Byeong Gwan
caf7700e2c
[iOS] Refactor error and data access (#2733)
* implement safe bounded data Access and cancellation supporting URLSession downloadTask

* declare specific SpineError type
declaring conformance to Error on String is discouraged, and Creating own Error type is recommended

* use explicit Error initializing rather than casing syntax (apply requested change)
2025-02-26 09:26:10 +01:00
Allen
7629d7dd35 [ios] Using SIMD to replace vector_float types can boost CPU performance on mid-range models. 2025-02-11 14:23:34 +01:00
Allen
b2061f1cf9
[ios] Using UnsafeBufferPointer to skip data copying and boost performance. (#2686)
* [ios] Using UnsafeBufferPointer to skip data copying and boost performance.

* [ios] Fix the extra data copying caused by using  and move the guard let condition to be earlier
2024-11-20 11:54:22 +01:00
kikiloveswift
000df07027
[ios] Fix the issue where the SkeletonBounds instance couldn’t be initialized (#2669)
Co-authored-by: liqiang <liqiangbj01@kanyun.com>
2024-11-14 12:21:14 +01:00
kikiloveswift
648170f325
[ios] Provide the ability to convert an Attachment into a BoundingBoxAttachment. (#2671)
Co-authored-by: liqiang <liqiangbj01@kanyun.com>
2024-11-14 12:19:17 +01:00
kikiloveswift
4f7fe00427
ADD: spine-ios support Cocoapods :Static Framework (#2658)
Co-authored-by: liqiang <liqiangbj01@kanyun.com>
2024-11-05 15:48:35 +01:00
Mario Zechner
19d3d1b29b [ios] Closes #2666, expose SkeletonBounds via spine-cpp-lite/Swift 2024-11-05 15:46:53 +01:00
Mario Zechner
7d6f0f9490 [ios] Fix blending, see #2555 2024-06-28 15:39:13 +02:00
Mario Zechner
a58346ff64 [ios] Add new spine-cpp-lite function. 2024-06-28 14:44:38 +02:00
Denis Andrašec
0d5c3e3b18
Spine iOS (#2504)
* Add `spine-iOS` SPM package & example app (#1)

* Basic Mesh Rendering (#2)

* Spine C++ Swift Wrapper (#3)

* Load `Atlas` & `SkeletonData` (#4)

Load & dispose `Atlas` & `SkeletonData` from bundled files.

* Generate Swift classes from `spine-cpp-lite.h` (#5)

* Draw `SkeletonData` render commands (#6)

- Use `SkeletonData` render commands in the renderer
- Simple loop for animation support

* Add `BoundsProvider` (#7)

- Implement & support `BoundsProvider` classes
- Introduce alignment and content mode
- Update c to swift script to return optional for find prefixed methods

* Support `SpineController` & `Event` callbacks (#8)

- Support SpineController callbacks
- Support Event callbacks
- Apply tint color in renderer

* Support `DressUp` sample (#9)

- Add `DressUp` sample
- Move SpineViewController to SpineUIView
- Implement SpineUIView export to image

* Remove unused file

* Add `Physics` sample (#10)

- Add `Physics` sample
- Fix offsets in `IKFollowing` sample
- Fix `SpineView` background color

* Add `DebugRendering` sample (#11)

- Add `DebugRendering` sample
- Make `SpineUIView` transparent

* Move remaining files to SPM package (#12)

- Move remaining files to SPM package
- Rename `SpineWrapper` to `SpineCppLite`

* Load assets from different sources (#13)

- Load from bundle, file, http & drawable
- Apply correct blend mode & pma in renderer

* Add `Obj-C` + `UIKit` sample (#14)

- Add `Obj-C` + `UIKit` sample
- Update `Spine` to be usable in Obj-C code base

* Support CocoaPods (#15)

* Metal Best Practices (#16)

- Tripple Buffering
- Buffer Bindings
- Shared Objects

* Annotate functions that should return optional (#17)

* Add option to disable drawing when out of viewport (#18)

- Add option to disable drawing when out of viewport
- Move update clock to controller so multiple views can share it

* Add docs for public Spine classes/methods (#19)

* Fix various regressions (#20)

- Fix retain `SpineController` retain cycle
- Fix issue wehre images were not rendered
2024-06-18 10:02:25 +02:00