Git Product home page Git Product logo

voicecontrolsample-ios's People

Contributors

nsoojin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

rheehot

voicecontrolsample-ios's Issues

`private (set) state: State`

지난 세미나를 매우 흥미롭게 보아 코드를 보던 중, state: State가 private set이 되는 것으로 보여 질문드립니다.
외부에서stateViewstate를 확인하기 위함으로 보이는데, stateMachine에 있는 currentState를 이용한

internal extension VoiceStateView {
    enum State: RawRepresentable {
        
        case attending, detecting, listening, processing, reporting
        
        var rawValue: GKState.Type {
            switch self {
            case .attending:
                return AttendingState.self
            case .detecting:
                return DetectingState.self
            case .listening:
                return ListeningState.self
            case .processing:
                return ProcessingState.self
            case .reporting:
                return ReportingState.self
            }
        }
        
        init?(rawValue: GKState.Type) {
            switch rawValue {
            case is AttendingState.Type:
                self = .attending
            case is DetectingState.Type:
                self = .detecting
            case is ListeningState.Type:
                self = .listening
            case is ProcessingState.Type:
                self = .processing
            case is ReportingState.Type:
                self = .reporting
            default:
                return nil
            }
        }
        
    }
}

...

var state: State? {
        guard let currentState = self.stateMachine.currentState else {
            return nil
        }
        return State(rawValue: type(of: currentState))
}

이와 같은 로직은 어떻게 생각하시는지 혹은 private set에 대한 다른 의도가 있으셨나 질문드립니다.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.