I have project written in Swift, inside project I have pod written in objective-C. I inherited from objective-C framework and make swift file. This objective-C framework has many classes with many private properties which I need to access and edit them. Framework in pods so I can't edit it directly. Any way how I can do it? With KVC or Swizzle anything ?
How to access private variable in swift child class from objective-c superclass?
1.3k views Asked by Danil At
1
There are 1 answers
Related Questions in SWIFT
- Navigate after logged in with webservice
- URLSession requesting JSON array from server not working
- When using onDrag in SwiftUI on Mac how can I detect when the dragged object has been released anywhere?
- Protect OpenAI key using Firebase function
- How to correct error: "Cannot convert value of type 'MyType.Type' to expected argument type 'Binding<MyType>'"?
- How to share metadata of an audio url file to a WhatsApp conversation with friends
- Using @Bindable with a Observable type in SwiftUI
- How to make a scroll view of 9 images in a forEach loop open on image 6 if image 6 is clicked on from a grid?
- Using MTLPixelFormat.rgba16Float results in random round-off errors
- Search and highlight text of current text in PDFKit Swift
- How is passing a function as a parameter related to escaping autoclosure?
- Actionable notification api call not working in background
- Custom layout occupies all horizontal space
- Is it possible to fix slow CKAsset loading on Cloudkit?
- Thread 1: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value - MapView.isMyLocationEnabled
Related Questions in INHERITANCE
- System.InvalidCastException while inheriting a class
- What effect does the `virtual` modifier have on an interface member?
- Is it allowed to pass "this" of derived class to constructor of base class?
- Why parent no-arg constructor is called?
- Python super().__init__() doesn't call multiple inherited classes?
- How to query child models from parent model data?
- .NET Core : disable parent application web.config inheritance
- Is it appropriate to subclass the parent's parameters in subclass __init__'s within python?
- Inheritance - is it possible to 'force' variable values relative to the derived class?
- Need more parameters in subclass overridden method
- How to call a method on a generic type from inside the generic class?
- Dependency Injection with Generic Interface and Inheritance
- Sparx Enterprise Architect - sysml - how to model a configuration on a block definition diagram using specialization
- Generic "Create" method in .NET Core that creates two entities
- crud operation and function with a an abstract class of which it had two subclasses
Related Questions in PRIVATE
- Why this can't happen? properties {get; set;} x Structs
- Azure Databricks to Cognitive Search connection timing out
- Deploy Flask Microblog in private ec2 with private RDS
- What are the best ways to protect private keys in code developed for the .NET framework?
- Why is there no change in the value of instance attribute even if I wrote my code to perform it (python)
- To access private arrays, classes are double-wrapped
- how to return a std::expect<T, E> from a function where T's move/copy constructor are deleted and has a private constructor
- Is there a way to add a friend class that is itself but with different template arguments?
- WooCommerce - Add a private item to the cart via 'add_to_cart'
- Problem with a mirc script to open a popup message when a user open a private chat with me
- How can I create routes by roles with next-auth/authjs nextjs/13/14?
- Analyzer Option or Lint Option for Flutter private variables?
- Separating git commits for private and public
- Assign a value to a variable in private section of class in C++
- Github Private repo access
Related Questions in KVC
- Successfully using KVC with Swift Structs
- Is UserDefaults.setValue() documented anywhere?
- Swift init via KeyPath / WritableKeyPath
- Can I give a property an alternate key name in Objective-C?
- Validate "Any" with validateValue: forKey in CoreData
- Realm error: "Primary key property 'Product.upc' has duplicate values after migration."
- Overriding bind method (Swift) - Err: Value of type 'Any' has no member 'addObserver'
- What is the use of #keyPath rather than directly passing key as a String?
- NSTextField bound to double in Swift, how to allow blank?
- Key-value observation weird behavior
- Why my code have different print when I run the same code
- How to access private variable in swift child class from objective-c superclass?
- Is there a way to access an array element in KVC using value(forKeyPath:)?
- How to learn about KVC with swift 4.2
- NSSortDescriptor sort by max property value in NSSet
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
First solution
Are you sure that you can not edit Pod script ? May be it's lock and the only thing you have to do is unlock the script and switch private variables to public (or delete the 'private' because in swift the variables are automatically public)
Second solution You can use protocol to access to this variables
I found for you a perfect tutorial Protocol/Delegate
Third solution
USE IT ONLY IF YOU HAVE NO IDEA: Use global variable, but it's not recommended to use this method. So if nobody here give you a better idea and you are stuck on this problem, use them until you find a better solution