swift - Calling a method from a struct within the same class -


i'd logically organize class properties signify 1 logical unit , distinguish them other class properties less tightly related.

i thought of doing using struct within class. however, seems can't call class methods struct property setters. seems inappropriate compile error: "missing argument parameter #1 in call"

this seems different calling method struct in swift function within struct. in case, methods generic , don't apply struct class properties. therefore, don't want move them within struct.

do have ideas on how organize properties tight(er) logical units within classes?

class myclass {     struct mystruct {         static var avarinmystruct: string? {             didset {                 anothervarinmystruct = foo()        // gives compile error "missing argument parameter #1 in call"             }         }         static var anothervarinmystruct: string?     }      func foo() {         println("i foo()")     } } 

the inner type mystruct knows nothing outer type myclass. there no foo function call mystruct. better organize code suggest use // mark: - whatever section is comments. types not here organize codes. types here create right abstractions program.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -