由于“私有"保护级别,无法访问func

编程入门 行业动态 更新时间:2024-10-27 01:29:46
本文介绍了由于“私有"保护级别,无法访问func的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试使用Swift 3将项目从iOS 8迁移到Xcode 8中的iOS 8到iOS10.我遇到了一个错误,在我的扩展程序中我声明了一些文件私有函数,而这些函数中的方法是由于私有保护级别而无法访问.

I'm trying to migrate my project from iOS 8 to iOS 10 in Xcode 8 using Swift 3. I've encountered an error where in my extension I've declared some file private functions, and the methods within those functions are inaccessible due to private protection level.

这是我得到错误的地方:

Here is where I get the error:

extension VideoViewerViewController: SeekerViewDelegate { fileprivate func seekerViewBeginSeeking(view: SeekerView) { self.shouldStartPlayingAfterSeek = self.player.rate > 0.0 //'shouldStartPlayingAfterSeek' is inaccessible due to 'private' protection level self.pause() //'pause()' is inaccessible due to 'private' protection level }

这是我的班级所遵循的协议:

This is the protocol that my class is conforming to:

private protocol SeekerViewDelegate: class { func seekerViewBeginSeeking(view: SeekerView) func seekerView(view: SeekerView, didSeek progress: CGFloat) func seekerViewDidEndSeeking(view: SeekerView) }

我仍在努力掌握文件私有,私有和内部文件的概念.

I'm still struggling to grasp the concept of fileprivate, private, and internal.

感谢所有帮助,谢谢

推荐答案

internal对当前模块是私有的. fileprivate是当前文件(以前称为private)的专用文件.新的private在当前范围内是私有的(更接近于大多数人可能认为私有的范围).

internal is private to the current module. fileprivate is private to the current file (which used to be called private). The new private is private to the current scope (closer to what most people probably think of as private).

更多推荐

由于“私有"保护级别,无法访问func

本文发布于:2023-11-26 19:57:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1634972.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:无法访问   级别   quot   func

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!