Comments (14)
Hey @scenee, the lib works (thanks!), however there are a good amount of properties that I can not access, such as:
public var isRemovalInteractionEnabled: Bool {
set { floatingPanel.isRemovalInteractionEnabled = newValue }
get { return floatingPanel.isRemovalInteractionEnabled }
}
because they are missing their @objc accesor, any way to add these please??
from floatingpanel.
Thanks for your feedback, @PasqualePuzio! I agree with you. I actually regret that this library loses objc API full compatibility because it has CocoaTouch-like API. But now I think the adapter approach is better for the reasons as you mention above.
from floatingpanel.
Hi there, since v2.0 the lib supports the full ObjC interoperability. Stay tuned.
from floatingpanel.
Hi @quannextfunc ,
I recommend to use this library in Objective-C project as the following steps
- Set up “Build Settings” in your project
- Set “Always Embedded Swift Standard Library” to “YES”
- Add
FlaotingPanelAdapter.swift
- You must also add a “Objective-C Bridging Header”(even if it's empty).
- Implement
FloatingPanelAdapter
with FloatingPanel in Swift
Here is an example project.
$ unzip SamplesObjCArchive.zip
$ cd SamplesObjC/
$ pod install
$open SamplesObjC.xcworkspace/
Finally, it's not possible to use FloatingPanel library directly in Objective-C. I tried to change it for ObjC, but the change will break APIs for Swift so I'm not planning to change it for ObjC.
from floatingpanel.
I managed to change it to support in ObjC, I had to pull put the Position enum out into ObjC.
FloatingPanelPosition.h
typedef NSString * FloatingPanelPosition NS_STRING_ENUM NS_SWIFT_NAME(FloatingPanelPosition);
FOUNDATION_EXPORT FloatingPanelPosition FloatingPanelPositionFull;
FOUNDATION_EXPORT FloatingPanelPosition FloatingPanelPositionHalf;
FOUNDATION_EXPORT FloatingPanelPosition FloatingPanelPositionTip;
FOUNDATION_EXPORT FloatingPanelPosition FloatingPanelPositionHidden;
NS_ASSUME_NONNULL_END
FloatingPanelPosition.m
FloatingPanelPosition FloatingPanelPositionFull = @"Full";
FloatingPanelPosition FloatingPanelPositionHalf = @"Half";
FloatingPanelPosition FloatingPanelPositionTip = @"Tip";
FloatingPanelPosition FloatingPanelPositionHidden = @"Hidden";
add the h to the bridging header and add @objc to functions/properties you want to expose to ObjC.
You'll need to add "default" to switches.
from floatingpanel.
@pichirichi you say
I managed to change it to support in ObjC
Assume this means within your own project. Any way you can contribute those changes back via a PR so others that want to use this library in obj-c can?
from floatingpanel.
At first, Thank you, @pichirichi. You gave me a great insight for the objc support.
I'm working to support ObjcC by creating a new artifact named as "FloatingPanelObjc.framework" that shares the core logic written in Swift with "FloatingPanel.framework"
Because I've struggled with the objc support in "FloatingPanel.framework" for a while, but these protocols and protocol extensions are the trouble.
FloatingPanelControllerDelegate
FloatingPanelLayout
FloatingPanelBehavior
If they support @objc
, the usability in Swift becomes poor because protocol extensions can't be used in @objc
protocols. https://bugs.swift.org/browse/SR-3349
As a result, I'm going to make "FloatingPanelObjc.framework".
from floatingpanel.
@pichirichi you say
I managed to change it to support in ObjC
Assume this means within your own project. Any way you can contribute those changes back via a PR so others that want to use this library in obj-c can?
Unfortunately it is too baked into our code since we also did some iOS 9 workarounds.
for Objc it is mainly the enum and @objc where it is required.|
We are not using all the functionality the pod provides so I'm not sure we covered all aspects.
from floatingpanel.
The wrapper approach might be a more elegant one, exposing the functions you need.
from floatingpanel.
I created FloatingPanelObjC.framework
in support-objc
branch. You can try it using both of CocoaPods and Carthage.
Carthage
github "scenee/FloatingPanel" "support-objc"
CocoaPods
pod 'FloatingPanelObjC', git: 'https://github.com/SCENEE/FloatingPanel.git', branch: "support-objc"
Could you please give me feedback about it?
NOTE: I didn't test it well, but I confirmed it worked with SamplesObjC app in this repo.
from floatingpanel.
I'm seeing a build error with Carthage when I try using the specified branch:
/Users/aaron/repos/OBANext/Carthage/Checkouts/FloatingPanel/Framework/Sources/FloatingPanelController.swift:102:18: error: method cannot be marked @objc because the type of the parameter cannot be represented in Objective-C
@objc public init(delegate: FloatingPanelControllerDelegate? = nil) {
^
CompileSwiftSources normal armv7 com.apple.xcode.tools.swift.compiler (in target: FloatingPanel)
cd /Users/aaron/repos/OBANext/Carthage/Checkouts/FloatingPanel/Framework
export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk
I can confirm this error also happens when I open FloatingPanel.xcworkspace
and build within Xcode.
from floatingpanel.
@aaronbrethorst, Thanks! I forgot to push a commit to fix the build error. Please try b14be9f
commit.
from floatingpanel.
Hi all,
my 2 cents on this: we have taken the "adapter" approach recommended by @scenee
I must say it proved to be a very elegant and clean solution, allowing us to preserve FloatingPanel without making any changes and integrate it into our objective c project.
Even though it may look complex at a first look, I believe in the long run it's a much better approach in terms of simplicity. With an adapter we don't need to develop and maintain an objective c porting if FloatingPanel.
from floatingpanel.
v2 has already supported full ObjC interoperability. Thank you for all 👍
from floatingpanel.
Related Issues (20)
- Issues after migrating to 2.0 HOT 1
- Transition to layout with a single anchor breaks panel behavior HOT 2
- Dismiss action does not remove contentViewController? HOT 2
- I can't find version 2.8.0 in pod search
- Extend or override backdropview HOT 5
- cannot respond to the didSelectItemAt | didSelectRowAt method
- Change backdropAlpha for FloatingPanelLayout blocks parent ViewController
- Small Devices (iPhone SE) Library won't add space for grabber HOT 3
- Second floating panel doesn't update to width of landscape view HOT 3
- SWIFTUI supports
- Is it possible to disable attraction between anchors? HOT 1
- Any support of Privacy Manifest? HOT 2
- 【Fixed】iPhone SE 2nd scroll lock HOT 1
- [SwiftUI] UIViewControllerRepresentable HOT 1
- Adaptive Layout doesn't work with compositional layout of collection view HOT 4
- Tracking WebView is broken in iOS 17.4.x HOT 6
- SWIFTUI - scroll issue
- Strange scrolling behavior - all content of the FloatingPanel is scrolling HOT 2
- Release 2.8.2 presents error in Xcode 16 beta: 'CALayerCornerCurve' is only available in iOS 13.0 or newer HOT 2
- Crash in file Core.swift
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from floatingpanel.