Skip to content

Commit 932f1dd

Browse files
committed
Make some @objc methods public so WordPressData can access them
I never looked into it, but apparently the `public` access level for `@objc` is required in a framework setup for those methods to be accessible through the `<framework name>-Swift.h` generated header. We run into the same issue in Keystone, see #24383
1 parent 7f6cac6 commit 932f1dd

File tree

8 files changed

+13
-12
lines changed

8 files changed

+13
-12
lines changed

WordPress/Classes/Extensions/Media/Media+Blog.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Foundation
22

3-
extension Media {
3+
public extension Media {
44

55
/// Inserts and returns a new managed Media object, in the context.
66
///

WordPress/Classes/Jetpack/Utility/SharedDataIssueSolver.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ public final class SharedDataIssueSolver: NSObject {
2424

2525
/// Helper method for creating an instance in Obj-C
2626
///
27-
class func instance() -> SharedDataIssueSolver {
27+
@objc
28+
public class func instance() -> SharedDataIssueSolver {
2829
return SharedDataIssueSolver()
2930
}
3031

WordPress/Classes/Models/Blog/Blog+Post.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ extension Blog {
3636
/// - Parameter foreignID: The foreign ID associated with the post; used to deduplicate new posts.
3737
/// - Returns: The `AbstractPost` associated with the given foreign ID.
3838
@objc(lookupPostWithForeignID:inContext:)
39-
func lookupPost(withForeignID foreignID: UUID, in context: NSManagedObjectContext) -> AbstractPost? {
39+
public func lookupPost(withForeignID foreignID: UUID, in context: NSManagedObjectContext) -> AbstractPost? {
4040
let request = NSFetchRequest<AbstractPost>(entityName: NSStringFromClass(AbstractPost.self))
4141
request.predicate = NSPredicate(format: "blog = %@ AND original = NULL AND \(#keyPath(AbstractPost.foreignID)) == %@", self, foreignID as NSUUID)
4242
request.fetchLimit = 1

WordPress/Classes/Models/Blog/Blog+SelfHosted.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ extension Blog {
6464

6565
@available(swift, obsoleted: 1.0)
6666
@objc(deleteApplicationToken)
67-
func objc_deleteApplicationToken() {
67+
public func objc_deleteApplicationToken() {
6868
_ = try? deleteApplicationToken()
6969
}
7070

WordPress/Classes/Networking/WordPressOrgRestApi+WordPress.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ private func apiBase(blog: Blog) -> URL? {
1717

1818
extension WordPressOrgRestApi {
1919
@objc
20-
convenience init?(blog: Blog) {
20+
public convenience init?(blog: Blog) {
2121
self.init(
2222
blog: blog,
2323
userAgent: WPUserAgent.wordPress(),

WordPress/Classes/RemotePost+Metadata.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Foundation
22
import WordPressShared
33

44
@objc
5-
extension RemotePost {
5+
public extension RemotePost {
66
var foreignID: UUID? {
77
guard let metadata else {
88
return nil

WordPress/Classes/Services/PostHelper+JetpackSocial.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
extension PostHelper {
2-
typealias StringDictionary = [String: String]
2+
public typealias StringDictionary = [String: String]
33
typealias Keys = Post.Constants
44
typealias SkipPrefix = Post.PublicizeMetadataSkipPrefix
55

@@ -15,7 +15,7 @@ extension PostHelper {
1515
/// - metadata: The metadata dictionary for the post. Optional because Obj-C shouldn't be trusted.
1616
/// - Returns: A dictionary for the `Post`'s `disabledPublicizeConnections` property.
1717
@objc(disabledPublicizeConnectionsForPost:andMetadata:)
18-
static func disabledPublicizeConnections(for post: AbstractPost?, metadata: [[String: Any]]?) -> [NSNumber: StringDictionary] {
18+
public static func disabledPublicizeConnections(for post: AbstractPost?, metadata: [[String: Any]]?) -> [NSNumber: StringDictionary] {
1919
guard let post, let metadata else {
2020
return [:]
2121
}
@@ -70,7 +70,7 @@ extension PostHelper {
7070
/// - Parameter post: The associated `Post` object.
7171
/// - Returns: An array of metadata dictionaries representing the `Post`'s disabled connections.
7272
@objc(publicizeMetadataEntriesForPost:)
73-
static func publicizeMetadataEntries(for post: Post?) -> [StringDictionary] {
73+
public static func publicizeMetadataEntries(for post: Post?) -> [StringDictionary] {
7474
guard let post,
7575
let disabledConnectionsDictionary = post.disabledPublicizeConnections else {
7676
return []

WordPress/Classes/Utility/Media/MediaFileManager.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public class MediaFileManager: NSObject {
5353
/// Helper method for getting a MediaFileManager for the .cache directory.
5454
///
5555
@objc(cacheManager)
56-
class var cache: MediaFileManager {
56+
public class var cache: MediaFileManager {
5757
return MediaFileManager(directory: .cache)
5858
}
5959

@@ -73,7 +73,7 @@ public class MediaFileManager: NSObject {
7373

7474
/// Returns filesystem URL for the local Media directory.
7575
///
76-
@objc func directoryURL() throws -> URL {
76+
@objc public func directoryURL() throws -> URL {
7777
let fileManager = FileManager.default
7878
let mediaDirectory = directory.url
7979
// Check whether or not the file path exists for the Media directory.
@@ -216,7 +216,7 @@ public class MediaFileManager: NSObject {
216216

217217
/// Helper method for getting the default upload directory URL.
218218
///
219-
@objc class func uploadsDirectoryURL() throws -> URL {
219+
@objc public class func uploadsDirectoryURL() throws -> URL {
220220
return try MediaFileManager.default.directoryURL()
221221
}
222222

0 commit comments

Comments
 (0)