Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customising IB mask properties #92

Merged
merged 9 commits into from Feb 14, 2016
Merged

Conversation

tbaranes
Copy link
Member

Here a first version of mask customisation from IB following the related threads. Should closed #8 #50 #76

The following implementation has been done for:

  • StarMask, IB usage: Star(6), Star(12)...
  • WaveMask, IB usage: Wave(up,50,100)

If one parameters is missing, or miswrite, we will fall back to the basic implementation with default values.
I also allowed some miswrite errors: Star(6 is accepted, as well as Wave(up, 50, 100)

Finally, I didn't implement the swifty enum. I concluded that we will still need a string enum in order to avoid hard coding strings or multiple constants for each mask. So, even if it's more swifty to have the following one, it will just create duplicates code.

public enum Mask {
    case Circle()
    case Star(branches: Int)
    case Wave(up: Bool, width: Int, offset: Int)
}

Missing:

  • README update: don't really know how to explain this feature... so I prefer let you handle this (if you don't mind)

I'm waiting your feedbacks on that :)

@tbaranes tbaranes changed the title Features/customising ib mask Customising IB mask properties Feb 13, 2016
@JakeLin
Copy link
Member

JakeLin commented Feb 14, 2016

@tbaranes , thanks for the PR, I found out it didn't work before because MaskType(rawValue: unwrappedMaskType) will return nil if we specify the parameter like Star(6), I have fixed it by adding additional check like

if unwrappedMaskType.hasPrefix(MaskType.Star.rawValue) {
        maskStarFromString(unwrappedMaskType)
      }

I have tested them, please have a look at my changes. Will update README.md later once we get that in master.

@tbaranes
Copy link
Member Author

Thanks for the fix Jake, I miss that point after refactoring the PR... my bad.
I'm gonna merge the PR once travis has finished its builds.

tbaranes added a commit that referenced this pull request Feb 14, 2016
@tbaranes tbaranes merged commit 2181f05 into master Feb 14, 2016
@tbaranes tbaranes deleted the features/customising_ib_mask branch February 14, 2016 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

More MaskDesignable
2 participants